Moved the IssuesController routing tests to an integration test.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3474 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0341ac80eb
commit
89cf2d256d
|
@ -53,13 +53,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
User.current = nil
|
||||
end
|
||||
|
||||
def test_index_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/issues'},
|
||||
:controller => 'issues', :action => 'index'
|
||||
)
|
||||
end
|
||||
|
||||
def test_index
|
||||
Setting.default_language = 'en'
|
||||
|
||||
|
@ -88,13 +81,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_tag :tag => 'a', :content => /Subproject issue/
|
||||
end
|
||||
|
||||
def test_index_with_project_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/23/issues'},
|
||||
:controller => 'issues', :action => 'index', :project_id => '23'
|
||||
)
|
||||
end
|
||||
|
||||
def test_index_should_not_list_issues_when_module_disabled
|
||||
EnabledModule.delete_all("name = 'issue_tracking' AND project_id = 1")
|
||||
get :index
|
||||
|
@ -105,13 +91,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_no_tag :tag => 'a', :content => /Can't print recipes/
|
||||
assert_tag :tag => 'a', :content => /Subproject issue/
|
||||
end
|
||||
|
||||
def test_index_with_project_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => 'projects/23/issues'},
|
||||
:controller => 'issues', :action => 'index', :project_id => '23'
|
||||
)
|
||||
end
|
||||
|
||||
def test_index_with_project
|
||||
Setting.display_subprojects_issues = 0
|
||||
|
@ -146,17 +125,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_tag :tag => 'a', :content => /Issue of a private subproject/
|
||||
end
|
||||
|
||||
def test_index_with_project_routing_formatted
|
||||
assert_routing(
|
||||
{:method => :get, :path => 'projects/23/issues.pdf'},
|
||||
:controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
|
||||
)
|
||||
assert_routing(
|
||||
{:method => :get, :path => 'projects/23/issues.atom'},
|
||||
:controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
|
||||
)
|
||||
end
|
||||
|
||||
def test_index_with_project_and_filter
|
||||
get :index, :project_id => 1, :set_filter => 1
|
||||
assert_response :success
|
||||
|
@ -208,17 +176,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_equal 'text/csv', @response.content_type
|
||||
end
|
||||
|
||||
def test_index_formatted
|
||||
assert_routing(
|
||||
{:method => :get, :path => 'issues.pdf'},
|
||||
:controller => 'issues', :action => 'index', :format => 'pdf'
|
||||
)
|
||||
assert_routing(
|
||||
{:method => :get, :path => 'issues.atom'},
|
||||
:controller => 'issues', :action => 'index', :format => 'atom'
|
||||
)
|
||||
end
|
||||
|
||||
def test_index_pdf
|
||||
get :index, :format => 'pdf'
|
||||
assert_response :success
|
||||
|
@ -347,24 +304,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_equal 'application/atom+xml', @response.content_type
|
||||
end
|
||||
|
||||
def test_show_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/issues/64'},
|
||||
:controller => 'issues', :action => 'show', :id => '64'
|
||||
)
|
||||
end
|
||||
|
||||
def test_show_routing_formatted
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/issues/2332.pdf'},
|
||||
:controller => 'issues', :action => 'show', :id => '2332', :format => 'pdf'
|
||||
)
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/issues/23123.atom'},
|
||||
:controller => 'issues', :action => 'show', :id => '23123', :format => 'atom'
|
||||
)
|
||||
end
|
||||
|
||||
def test_show_by_anonymous
|
||||
get :show, :id => 1
|
||||
assert_response :success
|
||||
|
@ -439,17 +378,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert @response.body.include?("<img src=\"http://test.host/attachments/download/10\" alt=\"\" />"), "Body did not match. Body: #{@response.body}"
|
||||
end
|
||||
|
||||
def test_new_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/1/issues/new'},
|
||||
:controller => 'issues', :action => 'new', :project_id => '1'
|
||||
)
|
||||
assert_recognizes(
|
||||
{:controller => 'issues', :action => 'new', :project_id => '1'},
|
||||
{:method => :post, :path => '/projects/1/issues'}
|
||||
)
|
||||
end
|
||||
|
||||
def test_show_export_to_pdf
|
||||
get :show, :id => 3, :format => 'pdf'
|
||||
assert_response :success
|
||||
|
@ -656,13 +584,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_copy_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/world_domination/issues/567/copy'},
|
||||
:controller => 'issues', :action => 'new', :project_id => 'world_domination', :copy_from => '567'
|
||||
)
|
||||
end
|
||||
|
||||
def test_copy_issue
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :project_id => 1, :copy_from => 1
|
||||
|
@ -672,17 +593,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_equal orig.subject, assigns(:issue).subject
|
||||
end
|
||||
|
||||
def test_edit_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/issues/1/edit'},
|
||||
:controller => 'issues', :action => 'edit', :id => '1'
|
||||
)
|
||||
assert_recognizes( #TODO: use a PUT on the issue URI isntead, need to adjust form
|
||||
{:controller => 'issues', :action => 'edit', :id => '1'},
|
||||
{:method => :post, :path => '/issues/1/edit'}
|
||||
)
|
||||
end
|
||||
|
||||
def test_get_edit
|
||||
@request.session[:user_id] = 2
|
||||
get :edit, :id => 1
|
||||
|
@ -733,13 +643,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_equal 'This is the test_new issue', issue.subject
|
||||
end
|
||||
|
||||
def test_reply_routing
|
||||
assert_routing(
|
||||
{:method => :post, :path => '/issues/1/quoted'},
|
||||
:controller => 'issues', :action => 'reply', :id => '1'
|
||||
)
|
||||
end
|
||||
|
||||
def test_reply_to_issue
|
||||
@request.session[:user_id] = 2
|
||||
get :reply, :id => 1
|
||||
|
@ -1107,17 +1010,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => Project.find(1).identifier
|
||||
end
|
||||
|
||||
def test_move_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/issues/1/move'},
|
||||
:controller => 'issues', :action => 'move', :id => '1'
|
||||
)
|
||||
assert_recognizes(
|
||||
{:controller => 'issues', :action => 'move', :id => '1'},
|
||||
{:method => :post, :path => '/issues/1/move'}
|
||||
)
|
||||
end
|
||||
|
||||
def test_move_one_issue_to_another_project
|
||||
@request.session[:user_id] = 2
|
||||
post :move, :id => 1, :new_project_id => 2, :tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => ''
|
||||
|
@ -1286,13 +1178,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
:class => 'icon-del disabled' }
|
||||
end
|
||||
|
||||
def test_destroy_routing
|
||||
assert_recognizes( #TODO: use DELETE on issue URI (need to change forms)
|
||||
{:controller => 'issues', :action => 'destroy', :id => '1'},
|
||||
{:method => :post, :path => '/issues/1/destroy'}
|
||||
)
|
||||
end
|
||||
|
||||
def test_destroy_issue_with_no_time_entries
|
||||
assert_nil TimeEntry.find_by_issue_id(2)
|
||||
@request.session[:user_id] = 2
|
||||
|
|
|
@ -18,9 +18,51 @@
|
|||
require "test_helper"
|
||||
|
||||
class RoutingTest < ActionController::IntegrationTest
|
||||
context "issues" do
|
||||
# REST actions
|
||||
should_route :get, "/issues", :controller => 'issues', :action => 'index'
|
||||
should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
|
||||
should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
|
||||
should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
|
||||
should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
|
||||
should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
|
||||
should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
|
||||
should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
|
||||
should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
|
||||
should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
|
||||
should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
|
||||
should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
|
||||
|
||||
should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
|
||||
|
||||
should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
|
||||
# TODO: Should use PUT
|
||||
should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
|
||||
|
||||
# TODO: Should use DELETE
|
||||
should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64'
|
||||
|
||||
# Extra actions
|
||||
should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
|
||||
|
||||
should_route :get, "/issues/1/move", :controller => 'issues', :action => 'move', :id => '1'
|
||||
should_route :post, "/issues/1/move", :controller => 'issues', :action => 'move', :id => '1'
|
||||
|
||||
should_route :post, "/issues/1/quoted", :controller => 'issues', :action => 'reply', :id => '1'
|
||||
|
||||
should_route :get, "/issues/calendar", :controller => 'issues', :action => 'calendar'
|
||||
should_route :post, "/issues/calendar", :controller => 'issues', :action => 'calendar'
|
||||
should_route :get, "/projects/project-name/issues/calendar", :controller => 'issues', :action => 'calendar', :project_id => 'project-name'
|
||||
should_route :post, "/projects/project-name/issues/calendar", :controller => 'issues', :action => 'calendar', :project_id => 'project-name'
|
||||
|
||||
should_route :get, "/issues/gantt", :controller => 'issues', :action => 'gantt'
|
||||
should_route :post, "/issues/gantt", :controller => 'issues', :action => 'gantt'
|
||||
should_route :get, "/projects/project-name/issues/gantt", :controller => 'issues', :action => 'gantt', :project_id => 'project-name'
|
||||
should_route :post, "/projects/project-name/issues/gantt", :controller => 'issues', :action => 'gantt', :project_id => 'project-name'
|
||||
end
|
||||
|
||||
context "issue reports" do
|
||||
should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
|
||||
should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue