Skip to content
Browse files

add tests for mixing :to and controller / action

  • Loading branch information...
1 parent af1c866 commit e3df1dd047170a440582fe95b5e0fafc12acbb48 @tenderlove tenderlove committed Jun 3, 2014
Showing with 48 additions and 0 deletions.
  1. +48 −0 actionpack/test/dispatch/routing_test.rb
View
48 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

0 comments on commit e3df1dd

Please sign in to comment.
Something went wrong with that request. Please try again.