diff options
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 |