Adds assertions to issue destroy tests.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8633 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
3c75d6036f
commit
3f33692cb3
|
@ -2479,14 +2479,20 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
def test_destroy_issue_with_no_time_entries
|
def test_destroy_issue_with_no_time_entries
|
||||||
assert_nil TimeEntry.find_by_issue_id(2)
|
assert_nil TimeEntry.find_by_issue_id(2)
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
|
|
||||||
|
assert_difference 'Issue.count', -1 do
|
||||||
delete :destroy, :id => 2
|
delete :destroy, :id => 2
|
||||||
|
end
|
||||||
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||||||
assert_nil Issue.find_by_id(2)
|
assert_nil Issue.find_by_id(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_issues_with_time_entries
|
def test_destroy_issues_with_time_entries
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
|
|
||||||
|
assert_no_difference 'Issue.count' do
|
||||||
delete :destroy, :ids => [1, 3]
|
delete :destroy, :ids => [1, 3]
|
||||||
|
end
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'destroy'
|
assert_template 'destroy'
|
||||||
assert_not_nil assigns(:hours)
|
assert_not_nil assigns(:hours)
|
||||||
|
@ -2497,7 +2503,12 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_destroy_issues_and_destroy_time_entries
|
def test_destroy_issues_and_destroy_time_entries
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
|
|
||||||
|
assert_difference 'Issue.count', -2 do
|
||||||
|
assert_difference 'TimeEntry.count', -3 do
|
||||||
delete :destroy, :ids => [1, 3], :todo => 'destroy'
|
delete :destroy, :ids => [1, 3], :todo => 'destroy'
|
||||||
|
end
|
||||||
|
end
|
||||||
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||||||
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
||||||
assert_nil TimeEntry.find_by_id([1, 2])
|
assert_nil TimeEntry.find_by_id([1, 2])
|
||||||
|
@ -2505,7 +2516,12 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_destroy_issues_and_assign_time_entries_to_project
|
def test_destroy_issues_and_assign_time_entries_to_project
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
|
|
||||||
|
assert_difference 'Issue.count', -2 do
|
||||||
|
assert_no_difference 'TimeEntry.count' do
|
||||||
delete :destroy, :ids => [1, 3], :todo => 'nullify'
|
delete :destroy, :ids => [1, 3], :todo => 'nullify'
|
||||||
|
end
|
||||||
|
end
|
||||||
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||||||
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
||||||
assert_nil TimeEntry.find(1).issue_id
|
assert_nil TimeEntry.find(1).issue_id
|
||||||
|
@ -2514,7 +2530,12 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_destroy_issues_and_reassign_time_entries_to_another_issue
|
def test_destroy_issues_and_reassign_time_entries_to_another_issue
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
|
|
||||||
|
assert_difference 'Issue.count', -2 do
|
||||||
|
assert_no_difference 'TimeEntry.count' do
|
||||||
delete :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 2
|
delete :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 2
|
||||||
|
end
|
||||||
|
end
|
||||||
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||||||
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
||||||
assert_equal 2, TimeEntry.find(1).issue_id
|
assert_equal 2, TimeEntry.find(1).issue_id
|
||||||
|
@ -2523,7 +2544,10 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_destroy_issues_from_different_projects
|
def test_destroy_issues_from_different_projects
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
|
|
||||||
|
assert_difference 'Issue.count', -3 do
|
||||||
delete :destroy, :ids => [1, 2, 6], :todo => 'destroy'
|
delete :destroy, :ids => [1, 2, 6], :todo => 'destroy'
|
||||||
|
end
|
||||||
assert_redirected_to :controller => 'issues', :action => 'index'
|
assert_redirected_to :controller => 'issues', :action => 'index'
|
||||||
assert !(Issue.find_by_id(1) || Issue.find_by_id(2) || Issue.find_by_id(6))
|
assert !(Issue.find_by_id(1) || Issue.find_by_id(2) || Issue.find_by_id(6))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue