aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/url_rewriter_tests.rb
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2005-07-18 03:12:45 +0000
committerNicholas Seckar <nseckar@gmail.com>2005-07-18 03:12:45 +0000
commit741316dc7123e8cdd750642dff6f39257d0ddbec (patch)
tree625a9fa623e03c1fb987088195dc13ea82336e25 /actionpack/test/controller/url_rewriter_tests.rb
parent2cdecff4d7fab760e5cca2f4f6c877c16bd7ab76 (diff)
downloadrails-741316dc7123e8cdd750642dff6f39257d0ddbec.tar.gz
rails-741316dc7123e8cdd750642dff6f39257d0ddbec.tar.bz2
rails-741316dc7123e8cdd750642dff6f39257d0ddbec.zip
Fixed construction of get parameters for arrays
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1857 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/url_rewriter_tests.rb')
-rw-r--r--actionpack/test/controller/url_rewriter_tests.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/controller/url_rewriter_tests.rb b/actionpack/test/controller/url_rewriter_tests.rb
new file mode 100644
index 0000000000..392024f03d
--- /dev/null
+++ b/actionpack/test/controller/url_rewriter_tests.rb
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class UrlRewriterTests < Test::Unit::TestCase
+ def setup
+ @request = ActionController::TestRequest.new
+ @params = {}
+ @rewriter = ActionController::UrlRewriter.new(@request, @params)
+ end
+
+ def test_simple_build_query_string
+ assert_equal '?x=1&y=2', @rewriter.send(:build_query_string, :x => '1', :y => '2')
+ end
+ def test_convert_ints_build_query_string
+ assert_equal '?x=1&y=2', @rewriter.send(:build_query_string, :x => 1, :y => 2)
+ end
+ def test_escape_spaces_build_query_string
+ assert_equal '?x=hello+world&y=goodbye+world', @rewriter.send(:build_query_string, :x => 'hello world', :y => 'goodbye world')
+ end
+ def test_expand_array_build_query_string
+ assert_equal '?x[]=1&x[]=2', @rewriter.send(:build_query_string, :x => [1, 2])
+ end
+
+ def test_escape_spaces_build_query_string_selected_keys
+ assert_equal '?x=hello+world', @rewriter.send(:build_query_string, {:x => 'hello world', :y => 'goodbye world'}, [:x])
+ end
+
+end