From 5476a6a6c7e3be5722481a2bd3b60322f1672c1e Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sat, 14 Jul 2007 09:28:56 +0000 Subject: Make :trailing_slash work with query parameters for url_for. Closes #4004 [nov] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7186 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/url_rewriter_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb index 1c746b7aee..a49aaa822a 100644 --- a/actionpack/test/controller/url_rewriter_test.rb +++ b/actionpack/test/controller/url_rewriter_test.rb @@ -73,6 +73,16 @@ class UrlRewriterTests < Test::Unit::TestCase assert_equal 'http://, test.host, /, hi, bye, {"id"=>"2"}', @rewriter.to_str end + + def test_trailing_slash + options = {:controller => 'foo', :action => 'bar', :id => '3', :only_path => true} + assert_equal '/foo/bar/3', @rewriter.rewrite(options) + assert_equal '/foo/bar/3?query=string', @rewriter.rewrite(options.merge({:query => 'string'})) + options.update({:trailing_slash => true}) + assert_equal '/foo/bar/3/', @rewriter.rewrite(options) + options.update({:query => 'string'}) + assert_equal '/foo/bar/3/?query=string', @rewriter.rewrite(options) + end end class UrlWriterTests < Test::Unit::TestCase -- cgit v1.2.3