summaryrefslogtreecommitdiffstats
path: root/test/functional/issues_controller_transaction_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-03 21:36:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-03 21:36:19 +0000
commit0178b5a2fe07e1160348b99ac56c19ebf154ca1b (patch)
tree53f762a779c95b598815864bb674463d90ef64d6 /test/functional/issues_controller_transaction_test.rb
parentbb1563f23ffabcf948797e0d8806c3d5344d09a7 (diff)
downloadredmine-0178b5a2fe07e1160348b99ac56c19ebf154ca1b.tar.gz
redmine-0178b5a2fe07e1160348b99ac56c19ebf154ca1b.zip
Private issue notes (#1554).
Adds 2 new permissions for viewing/adding private comments to issues. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10547 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/issues_controller_transaction_test.rb')
-rw-r--r--test/functional/issues_controller_transaction_test.rb31
1 files changed, 21 insertions, 10 deletions
diff --git a/test/functional/issues_controller_transaction_test.rb b/test/functional/issues_controller_transaction_test.rb
index 84f9adc91..7e1fa0d00 100644
--- a/test/functional/issues_controller_transaction_test.rb
+++ b/test/functional/issues_controller_transaction_test.rb
@@ -62,9 +62,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
:id => issue.id,
:issue => {
:fixed_version_id => 4,
+ :notes => 'My notes',
:lock_version => (issue.lock_version - 1)
},
- :notes => 'My notes',
:time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id }
end
end
@@ -93,9 +93,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
:id => issue.id,
:issue => {
:fixed_version_id => 4,
+ :notes => 'My notes',
:lock_version => (issue.lock_version - 1)
},
- :notes => 'My notes',
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}},
:time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id }
end
@@ -116,15 +116,14 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => issue.id,
:issue => {
:fixed_version_id => 4,
+ :notes => '',
:lock_version => (issue.lock_version - 1)
- },
- :notes => ''
+ }
assert_tag 'div', :attributes => {:class => 'conflict'}
assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'overwrite'}
assert_no_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'add_notes'}
assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'cancel'}
-
end
def test_update_stale_issue_should_show_conflicting_journals
@@ -133,9 +132,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
+ :notes => '',
:lock_version => 2
},
- :notes => '',
:last_journal_id => 1
assert_not_nil assigns(:conflict_journals)
@@ -151,9 +150,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
+ :notes => '',
:lock_version => 2
},
- :notes => '',
:last_journal_id => ''
assert_not_nil assigns(:conflict_journals)
@@ -164,6 +163,18 @@ class IssuesControllerTransactionTest < ActionController::TestCase
:descendant => {:content => /Journal notes/}
end
+ def test_update_stale_issue_should_show_private_journals_with_permission_only
+ journal = Journal.create!(:journalized => Issue.find(1), :notes => 'Privates notes', :private_notes => true, :user_id => 1)
+
+ @request.session[:user_id] = 2
+ put :update, :id => 1, :issue => {:fixed_version_id => 4, :lock_version => 2}, :last_journal_id => ''
+ assert_include journal, assigns(:conflict_journals)
+
+ Role.find(1).remove_permission! :view_private_notes
+ put :update, :id => 1, :issue => {:fixed_version_id => 4, :lock_version => 2}, :last_journal_id => ''
+ assert_not_include journal, assigns(:conflict_journals)
+ end
+
def test_update_stale_issue_with_overwrite_conflict_resolution_should_update
@request.session[:user_id] = 2
@@ -171,9 +182,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
+ :notes => 'overwrite_conflict_resolution',
:lock_version => 2
},
- :notes => 'overwrite_conflict_resolution',
:conflict_resolution => 'overwrite'
end
@@ -192,9 +203,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
+ :notes => 'add_notes_conflict_resolution',
:lock_version => 2
},
- :notes => 'add_notes_conflict_resolution',
:conflict_resolution => 'add_notes'
end
@@ -213,9 +224,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
+ :notes => 'add_notes_conflict_resolution',
:lock_version => 2
},
- :notes => 'add_notes_conflict_resolution',
:conflict_resolution => 'cancel'
end