aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-09-15 05:24:29 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-09-15 05:24:29 +0000
commitc1505e3e2b1a4f0d6d9c29731cac1dc096c13d2e (patch)
tree5a9cca9682e88f72df256774835a485b15f52932 /actionpack/test
parentd985260ed7896837677d9ef80b249d46c59dff9f (diff)
downloadrails-c1505e3e2b1a4f0d6d9c29731cac1dc096c13d2e.tar.gz
rails-c1505e3e2b1a4f0d6d9c29731cac1dc096c13d2e.tar.bz2
rails-c1505e3e2b1a4f0d6d9c29731cac1dc096c13d2e.zip
Included UrlRewriter tests in rake run and made them not depend on Hash order
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2244 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/url_rewriter_test.rb (renamed from actionpack/test/controller/url_rewriter_tests.rb)19
1 files changed, 14 insertions, 5 deletions
diff --git a/actionpack/test/controller/url_rewriter_tests.rb b/actionpack/test/controller/url_rewriter_test.rb
index af26c2dcf5..1219abdd9f 100644
--- a/actionpack/test/controller/url_rewriter_tests.rb
+++ b/actionpack/test/controller/url_rewriter_test.rb
@@ -8,20 +8,20 @@ class UrlRewriterTests < Test::Unit::TestCase
end
def test_simple_build_query_string
- assert_equal '?x=1&y=2', @rewriter.send(:build_query_string, :x => '1', :y => '2')
+ assert_query_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)
+ assert_query_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')
+ assert_query_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])
+ assert_query_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])
+ assert_query_equal '?x=hello+world', @rewriter.send(:build_query_string, {:x => 'hello world', :y => 'goodbye world'}, [:x])
end
def test_overwrite_params
@@ -34,4 +34,13 @@ class UrlRewriterTests < Test::Unit::TestCase
assert_match %r(/hi/hi/2$), u
end
+
+ private
+ def split_query_string(str)
+ [str[0].chr] + str[1..-1].split(/&/).sort
+ end
+
+ def assert_query_equal(q1, q2)
+ assert_equal(split_query_string(q1), split_query_string(q2))
+ end
end