diff options
author | Tatiana Soukiassian <binaryberry@gmail.com> | 2014-12-13 15:34:41 +0000 |
---|---|---|
committer | Tatiana Soukiassian <binaryberry@gmail.com> | 2014-12-13 15:42:15 +0000 |
commit | 1a50be823186082e8b5a29d8e9ea3a289318d9c1 (patch) | |
tree | 364f24c8e612f63d6ca1739a38353ff9f1d23455 /actionpack/test/dispatch/routing_test.rb | |
parent | 9688270d3e0994ce57de0adbc72b3ab4faaf2c32 (diff) | |
download | rails-1a50be823186082e8b5a29d8e9ea3a289318d9c1.tar.gz rails-1a50be823186082e8b5a29d8e9ea3a289318d9c1.tar.bz2 rails-1a50be823186082e8b5a29d8e9ea3a289318d9c1.zip |
Fix handling of positional url helper arguments when format is false
There is no need to subtract one from the path_params size when there is
no format parameter because it is not present in the path_params array.
Fixes #17819.
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index d0a624784a..aae95fb355 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -4433,3 +4433,31 @@ class TestUrlGenerationErrors < ActionDispatch::IntegrationTest assert_equal message, error.message end end + +class TestDefaultUrlOptions < ActionDispatch::IntegrationTest + class PostsController < ActionController::Base + def archive + render :text => "posts#archive" + end + end + + Routes = ActionDispatch::Routing::RouteSet.new + Routes.draw do + default_url_options locale: 'en' + scope ':locale', format: false do + get '/posts/:year/:month/:day', to: 'posts#archive', as: 'archived_posts' + end + end + + APP = build_app Routes + + def app + APP + end + + include Routes.url_helpers + + def test_positional_args_with_format_false + assert_equal '/en/posts/2014/12/13', archived_posts_path(2014, 12, 13) + end +end |