aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2011-03-09 14:44:25 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2011-03-09 14:44:25 +0000
commit03cbd9672cfc142842c95aae0fb27b8eb27e6990 (patch)
treec1141b17caaf6185b19a47eb74e6d2a0ffe3971a /actionpack/test/controller
parentf41dd99be78e6e0243e9910aaab64ebd29bdad58 (diff)
downloadrails-03cbd9672cfc142842c95aae0fb27b8eb27e6990.tar.gz
rails-03cbd9672cfc142842c95aae0fb27b8eb27e6990.tar.bz2
rails-03cbd9672cfc142842c95aae0fb27b8eb27e6990.zip
Filter params that return nil for to_param and allow through false values
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/url_for_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/controller/url_for_test.rb b/actionpack/test/controller/url_for_test.rb
index 1c28da33bd..3f3d6dcc2f 100644
--- a/actionpack/test/controller/url_for_test.rb
+++ b/actionpack/test/controller/url_for_test.rb
@@ -311,6 +311,14 @@ module AbstractController
assert_equal("/c/a", W.new.url_for(HashWithIndifferentAccess.new('controller' => 'c', 'action' => 'a', 'only_path' => true)))
end
+ def test_url_params_with_nil_to_param_are_not_in_url
+ assert_equal("/c/a", W.new.url_for(:only_path => true, :controller => 'c', :action => 'a', :id => Struct.new(:to_param).new(nil)))
+ end
+
+ def test_false_url_params_are_included_in_query
+ assert_equal("/c/a?show=false", W.new.url_for(:only_path => true, :controller => 'c', :action => 'a', :show => false))
+ end
+
private
def extract_params(url)
url.split('?', 2).last.split('&').sort