From e3df1dd047170a440582fe95b5e0fafc12acbb48 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 3 Jun 2014 11:36:32 -0700 Subject: [PATCH] add tests for mixing :to and controller / action --- actionpack/test/dispatch/routing_test.rb | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 7dd19ae855c34..ba9d01525836d 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -3255,6 +3255,54 @@ def test_shallow_path_inside_namespace_is_not_added_twice assert_equal '/admin/posts/1/comments', admin_post_comments_path('1') end + def test_mix_string_to_controller_action + draw do + get '/projects', controller: 'project_files', + action: 'index', + to: 'comments#index' + end + get '/projects' + assert_equal 'comments#index', @response.body + end + + def test_mix_string_to_controller + draw do + get '/projects', controller: 'project_files', + to: 'comments#index' + end + get '/projects' + assert_equal 'comments#index', @response.body + end + + def test_mix_string_to_action + draw do + get '/projects', action: 'index', + to: 'comments#index' + end + get '/projects' + assert_equal 'comments#index', @response.body + end + + def test_mix_symbol_to_controller_action + draw do + get '/projects', controller: 'project_files', + action: 'index', + to: :show + end + get '/projects' + assert_equal 'project_files#show', @response.body + end + + def test_mix_string_to_controller_action + draw do + get '/projects', controller: 'project_files', + action: 'index', + to: 'show' + end + get '/projects' + assert_equal 'show#index', @response.body + end + def test_shallow_path_and_prefix_are_not_added_to_non_shallow_routes draw do scope shallow_path: 'projects', shallow_prefix: 'project' do