From 1a50be823186082e8b5a29d8e9ea3a289318d9c1 Mon Sep 17 00:00:00 2001 From: Tatiana Soukiassian Date: Sat, 13 Dec 2014 15:34:41 +0000 Subject: 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. --- actionpack/test/dispatch/routing_test.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'actionpack/test/dispatch/routing_test.rb') 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 -- cgit v1.2.3