diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2012-08-04 11:33:30 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2012-08-04 11:33:30 +0100 |
commit | 067efad8af6e84e45518120a77dfbb0b49c94469 (patch) | |
tree | 2d3043f4348d104ffed67afc2b89d47f98a85379 /actionpack/test | |
parent | 3d3fa165e40c8cdaaebdab9dd2985d0ca3a36236 (diff) | |
parent | 6be564c7a087773cb0b51c54396cc190e4f5c983 (diff) | |
download | rails-067efad8af6e84e45518120a77dfbb0b49c94469.tar.gz rails-067efad8af6e84e45518120a77dfbb0b49c94469.tar.bz2 rails-067efad8af6e84e45518120a77dfbb0b49c94469.zip |
Merge branch 'polymorphic_url_builds_query_string_with_array'
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/activerecord/polymorphic_routes_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/activerecord/polymorphic_routes_test.rb b/actionpack/test/activerecord/polymorphic_routes_test.rb index afb714484b..9454a6d726 100644 --- a/actionpack/test/activerecord/polymorphic_routes_test.rb +++ b/actionpack/test/activerecord/polymorphic_routes_test.rb @@ -309,6 +309,27 @@ class PolymorphicRoutesTest < ActionController::TestCase end end + def test_with_array_containing_simple_hash + with_test_routes do + @project.save + assert_equal "http://example.com/projects/#{@project.id}?foo=bar", polymorphic_url([@project, :foo => 'bar' ]) + end + end + + def test_with_array_containing_complex_hash + with_test_routes do + @project.save + assert_equal "http://example.com/projects/#{@project.id}?foo=bar&nested%5Bfoo%5D=bar", polymorphic_url([@project, :nested => { :foo => 'bar' }, :foo => 'bar']) + end + end + + def test_with_array_containing_simple_hash_options_take_precedence + with_test_routes do + @project.save + assert_equal "http://example.com/projects/#{@project.id}?foo=baz", polymorphic_url([@project, :foo => 'bar' ], :foo => 'baz') + end + end + def test_with_array_containing_single_name with_test_routes do @project.save |