Permalink
Browse files

add tests for path based url_for calls

  • Loading branch information...
tenderlove committed May 8, 2014
1 parent 2a10028 commit ea58684b579beb8fbf87dde5dbf8694c453d10f9
Showing with 19 additions and 2 deletions.
  1. +19 −2 actionview/test/activerecord/polymorphic_routes_test.rb
@@ -99,8 +99,7 @@ def test_string_with_options
def test_symbol
with_test_routes do
- assert_equal "http://example.com/projects", polymorphic_url(:projects)
- assert_equal "http://example.com/projects", url_for(:projects)
+ assert_url "http://example.com/projects", :projects
end
end
@@ -214,6 +213,11 @@ def test_new_record_arguments
params = args
super(*args)
}
+
+ define_method("projects_path") { |*args|
+ params = args
+ super(*args)
+ }
}
assert_url "http://example.com/projects", @project
@@ -640,3 +644,16 @@ def with_admin_and_site_test_routes(options = {})
end
end
end
+
+class PolymorphicPathRoutesTest < PolymorphicRoutesTest
+ include ActionView::RoutingUrlFor
+ include ActionView::Context
+
+ attr_accessor :controller
+
+ def assert_url(url, args)
+ host = self.class.default_url_options[:host]
+
+ assert_equal url.sub(/http:\/\/#{host}/, ''), url_for(args)
+ end
+end

0 comments on commit ea58684

Please sign in to comment.