summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-02-29 22:54:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-02-29 22:54:07 +0000
commitc01c64e9783dc361d98ca8dc37d2b3a661ae1945 (patch)
tree42c3c5a2b6e59e5a1879601f37d69d4c651911e3 /test/functional
parent87742f23edb3bbcbaf12540d2ff510ad8edac09e (diff)
downloadredmine-c01c64e9783dc361d98ca8dc37d2b3a661ae1945.tar.gz
redmine-c01c64e9783dc361d98ca8dc37d2b3a661ae1945.zip
Let the user choose when deleting issues with reported hours (closes #734, #71):
* to delete the hours * to assign the hours to the project * to reassign the hours to another issue git-svn-id: http://redmine.rubyforge.org/svn/trunk@1182 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/issues_controller_test.rb44
1 files changed, 40 insertions, 4 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 34b030d98..da8118668 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -37,7 +37,8 @@ class IssuesControllerTest < Test::Unit::TestCase
:workflows,
:custom_fields,
:custom_values,
- :custom_fields_trackers
+ :custom_fields_trackers,
+ :time_entries
def setup
@controller = IssuesController.new
@@ -428,13 +429,48 @@ class IssuesControllerTest < Test::Unit::TestCase
:class => 'icon-del disabled' }
end
- def test_destroy
+ def test_destroy_issue_with_no_time_entries
@request.session[:user_id] = 2
- post :destroy, :id => 1
+ post :destroy, :id => 3
assert_redirected_to 'projects/ecookbook/issues'
- assert_nil Issue.find_by_id(1)
+ assert_nil Issue.find_by_id(3)
end
+ def test_destroy_issues_with_time_entries
+ @request.session[:user_id] = 2
+ post :destroy, :ids => [1, 3]
+ assert_response :success
+ assert_template 'destroy'
+ assert_not_nil assigns(:hours)
+ assert Issue.find_by_id(1) && Issue.find_by_id(3)
+ end
+
+ def test_destroy_issues_and_destroy_time_entries
+ @request.session[:user_id] = 2
+ post :destroy, :ids => [1, 3], :todo => 'destroy'
+ assert_redirected_to 'projects/ecookbook/issues'
+ assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
+ assert_nil TimeEntry.find_by_id([1, 2])
+ end
+
+ def test_destroy_issues_and_assign_time_entries_to_project
+ @request.session[:user_id] = 2
+ post :destroy, :ids => [1, 3], :todo => 'nullify'
+ assert_redirected_to 'projects/ecookbook/issues'
+ assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
+ assert_nil TimeEntry.find(1).issue_id
+ assert_nil TimeEntry.find(2).issue_id
+ end
+
+ def test_destroy_issues_and_reassign_time_entries_to_another_issue
+ @request.session[:user_id] = 2
+ post :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 2
+ assert_redirected_to 'projects/ecookbook/issues'
+ assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
+ assert_equal 2, TimeEntry.find(1).issue_id
+ assert_equal 2, TimeEntry.find(2).issue_id
+ end
+
def test_destroy_attachment
issue = Issue.find(3)
a = issue.attachments.size