Skip to content

Commit

Permalink
add tests for mixing :to and controller / action
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jun 3, 2014
1 parent af1c866 commit e3df1dd
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions actionpack/test/dispatch/routing_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit e3df1dd

Please sign in to comment.