summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-03-21 02:12:32 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-03-21 02:12:32 +0000
commitdd70327ce4d11d21382f1c9ac7de4c64c7f0bb7f (patch)
treec16aed3429ce717ae15cbf4b9f7987ee15a71af4 /test
parent273aa42900a0cd67ab60cc59217528362425f1f1 (diff)
downloadredmine-dd70327ce4d11d21382f1c9ac7de4c64c7f0bb7f.tar.gz
redmine-dd70327ce4d11d21382f1c9ac7de4c64c7f0bb7f.zip
Let user choose an issue of another project when updating a time entry (#16338).
git-svn-id: http://svn.redmine.org/redmine/trunk@12990 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/timelog_controller_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 376faf3ae..a64775039 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -289,6 +289,28 @@ class TimelogControllerTest < ActionController::TestCase
assert_equal 2, entry.user_id
end
+ def test_update_should_allow_to_change_issue_to_another_project
+ entry = TimeEntry.generate!(:issue_id => 1)
+
+ @request.session[:user_id] = 1
+ put :update, :id => entry.id, :time_entry => {:issue_id => '5'}
+ assert_response 302
+ entry.reload
+
+ assert_equal 5, entry.issue_id
+ assert_equal 3, entry.project_id
+ end
+
+ def test_update_should_not_allow_to_change_issue_to_an_invalid_project
+ entry = TimeEntry.generate!(:issue_id => 1)
+ Project.find(3).disable_module!(:time_tracking)
+
+ @request.session[:user_id] = 1
+ put :update, :id => entry.id, :time_entry => {:issue_id => '5'}
+ assert_response 200
+ assert_include "Issue is invalid", assigns(:time_entry).errors.full_messages
+ end
+
def test_get_bulk_edit
@request.session[:user_id] = 2
get :bulk_edit, :ids => [1, 2]