aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/activerecord/polymorphic_routes_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-05-08 15:56:15 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-05-08 15:56:15 -0700
commitea58684b579beb8fbf87dde5dbf8694c453d10f9 (patch)
treeb39389424f9816f2bb4374ccd27002440cf206ac /actionview/test/activerecord/polymorphic_routes_test.rb
parent2a10028ee341a9e45904552924eb94b189df6565 (diff)
downloadrails-ea58684b579beb8fbf87dde5dbf8694c453d10f9.tar.gz
rails-ea58684b579beb8fbf87dde5dbf8694c453d10f9.tar.bz2
rails-ea58684b579beb8fbf87dde5dbf8694c453d10f9.zip
add tests for path based url_for calls
Diffstat (limited to 'actionview/test/activerecord/polymorphic_routes_test.rb')
-rw-r--r--actionview/test/activerecord/polymorphic_routes_test.rb21
1 files changed, 19 insertions, 2 deletions
diff --git a/actionview/test/activerecord/polymorphic_routes_test.rb b/actionview/test/activerecord/polymorphic_routes_test.rb
index dead717190..bcdb4f4376 100644
--- a/actionview/test/activerecord/polymorphic_routes_test.rb
+++ b/actionview/test/activerecord/polymorphic_routes_test.rb
@@ -99,8 +99,7 @@ class PolymorphicRoutesTest < ActionController::TestCase
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 @@ class PolymorphicRoutesTest < ActionController::TestCase
params = args
super(*args)
}
+
+ define_method("projects_path") { |*args|
+ params = args
+ super(*args)
+ }
}
assert_url "http://example.com/projects", @project
@@ -640,3 +644,16 @@ class PolymorphicRoutesTest < ActionController::TestCase
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