Use should_route in routing tests.

git-svn-id: http://svn.redmine.org/redmine/trunk@13608 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2014-11-16 14:23:32 +00:00
parent d72e1f95ba
commit ecda1c7a4f
46 changed files with 539 additions and 1808 deletions

View File

@@ -17,50 +17,17 @@
require File.expand_path('../../../test_helper', __FILE__)
class RoutingMessagesTest < ActionDispatch::IntegrationTest
class RoutingMessagesTest < Redmine::RoutingTest
def test_messages
assert_routing(
{ :method => 'get', :path => "/boards/22/topics/2" },
{ :controller => 'messages', :action => 'show', :id => '2',
:board_id => '22' }
)
assert_routing(
{ :method => 'get', :path => "/boards/lala/topics/new" },
{ :controller => 'messages', :action => 'new', :board_id => 'lala' }
)
assert_routing(
{ :method => 'get', :path => "/boards/lala/topics/22/edit" },
{ :controller => 'messages', :action => 'edit', :id => '22',
:board_id => 'lala' }
)
assert_routing(
{ :method => 'post', :path => "/boards/lala/topics/quote/22" },
{ :controller => 'messages', :action => 'quote', :id => '22',
:board_id => 'lala' }
)
assert_routing(
{ :method => 'post', :path => "/boards/lala/topics/new" },
{ :controller => 'messages', :action => 'new', :board_id => 'lala' }
)
assert_routing(
{ :method => 'post', :path => "/boards/lala/topics/preview" },
{ :controller => 'messages', :action => 'preview',
:board_id => 'lala' }
)
assert_routing(
{ :method => 'post', :path => "/boards/lala/topics/22/edit" },
{ :controller => 'messages', :action => 'edit', :id => '22',
:board_id => 'lala' }
)
assert_routing(
{ :method => 'post', :path => "/boards/22/topics/555/replies" },
{ :controller => 'messages', :action => 'reply', :id => '555',
:board_id => '22' }
)
assert_routing(
{ :method => 'post', :path => "/boards/22/topics/555/destroy" },
{ :controller => 'messages', :action => 'destroy', :id => '555',
:board_id => '22' }
)
# TODO: refactor routes
should_route 'GET /boards/22/topics/new' => 'messages#new', :board_id => '22'
should_route 'POST /boards/22/topics/new' => 'messages#new', :board_id => '22'
should_route 'POST /boards/22/topics/preview' => 'messages#preview', :board_id => '22'
should_route 'GET /boards/22/topics/2' => 'messages#show', :id => '2', :board_id => '22'
should_route 'GET /boards/22/topics/2/edit' => 'messages#edit', :id => '2', :board_id => '22'
should_route 'POST /boards/22/topics/quote/2' => 'messages#quote', :id => '2', :board_id => '22'
should_route 'POST /boards/22/topics/2/replies' => 'messages#reply', :id => '2', :board_id => '22'
should_route 'POST /boards/22/topics/2/destroy' => 'messages#destroy', :id => '2', :board_id => '22'
end
end