diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-03-19 10:14:29 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-03-19 10:14:29 +0000 |
commit | e50190a82a5b6a066a3fadfdebf9df6e268719ad (patch) | |
tree | c49f3341b96612314a1f0e238102cce24f1aaaa7 /test/unit/journal_test.rb | |
parent | 23874fa913c62f7da23f2d1fab6e5e1a445ae290 (diff) | |
download | redmine-e50190a82a5b6a066a3fadfdebf9df6e268719ad.tar.gz redmine-e50190a82a5b6a066a3fadfdebf9df6e268719ad.zip |
Automatically add the user to the watchers list after contributing to an issue (#4347). User can enable/disable this feature from My Account.
Patch by Takenori TAKAKI and Jens Krämer.
git-svn-id: http://svn.redmine.org/redmine/trunk@21469 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/journal_test.rb')
-rw-r--r-- | test/unit/journal_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb index f9c269291..cf86a7990 100644 --- a/test/unit/journal_test.rb +++ b/test/unit/journal_test.rb @@ -120,6 +120,28 @@ class JournalTest < ActiveSupport::TestCase end end + def test_create_should_add_wacher + user = User.first + user.pref.auto_watch_on=['issue_contributed_to'] + user.save + journal = Journal.new(:journalized => Issue.first, :notes => 'notes', :user => user) + + assert_difference 'Watcher.count', 1 do + assert_equal true, journal.save + end + end + + def test_create_should_not_add_watcher + user = User.first + user.pref.auto_watch_on=[] + user.save + journal = Journal.new(:journalized => Issue.first, :notes => 'notes', :user => user) + + assert_no_difference 'Watcher.count' do + assert_equal true, journal.save + end + end + def test_visible_scope_for_anonymous # Anonymous user should see issues of public projects only journals = Journal.visible(User.anonymous).to_a |