aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDan Langevin <dan.langevin@lifebooker.com>2014-05-05 18:25:29 -0400
committerDan Langevin <dan.langevin@lifebooker.com>2014-05-22 16:03:52 -0400
commit82b4d879bf31ebf409217e2c770cedfb7c79a44a (patch)
treeb9d82dd81e9b9bf2e88cb6d30ca4f26988f7ad2e /actionpack/test
parentb6bab2af144d3f35ae2e1661286f2e35f43f5d3a (diff)
downloadrails-82b4d879bf31ebf409217e2c770cedfb7c79a44a.tar.gz
rails-82b4d879bf31ebf409217e2c770cedfb7c79a44a.tar.bz2
rails-82b4d879bf31ebf409217e2c770cedfb7c79a44a.zip
Fixes URL generation with trailing_slash: true
URL generation with trailing_slash: true was adding a trailing slash after .:format Routes.draw do resources :bars end bars_url(trailing_slash: true, format: 'json') # => /bars.json/ This commit removes that extra trailing slash
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/url_generation_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/url_generation_test.rb b/actionpack/test/dispatch/url_generation_test.rb
index fdea27e2d2..445eb50b68 100644
--- a/actionpack/test/dispatch/url_generation_test.rb
+++ b/actionpack/test/dispatch/url_generation_test.rb
@@ -15,6 +15,8 @@ module TestUrlGeneration
Routes.draw do
get "/foo", :to => "my_route_generating#index", :as => :foo
+ resources :bars
+
mount MyRouteGeneratingController.action(:index), at: '/bar'
end
@@ -97,6 +99,22 @@ module TestUrlGeneration
test "omit subdomain when key is blank" do
assert_equal "http://example.com/foo", foo_url(subdomain: "")
end
+
+ test "generating URLs with trailing slashes" do
+ assert_equal "/bars.json", bars_path(
+ trailing_slash: true,
+ format: 'json'
+ )
+ end
+
+ test "generating URLS with querystring and trailing slashes" do
+ assert_equal "/bars.json?a=b", bars_path(
+ trailing_slash: true,
+ a: 'b',
+ format: 'json'
+ )
+ end
+
end
end