diff options
author | Jakub Zienkiewicz <jakub@zienkiewi.cz> | 2013-09-13 15:38:30 +0200 |
---|---|---|
committer | Jakub Zienkiewicz <jakub@zienkiewi.cz> | 2013-09-13 15:38:30 +0200 |
commit | 996d146cbd6987d54bc720550b96aacd90c2982a (patch) | |
tree | d3bfbc0a8a11b5d45dd99aad4fac94aab819aadc /spec/services | |
parent | 5ff79f9494c154c963190016e701170545d91617 (diff) | |
download | gitlab-ce-996d146cbd6987d54bc720550b96aacd90c2982a.tar.gz |
test if commit author receives new note notifications
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/notification_service_spec.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index 6a63a8aceb2..a112835d4d0 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -52,10 +52,12 @@ describe NotificationService do before do build_team(note.project) + note.stub(:commit_author => @u_committer) end describe :new_note do it do + should_email(@u_committer.id, note) should_email(@u_watcher.id, note) should_not_email(@u_mentioned.id, note) should_not_email(note.author_id, note) @@ -65,18 +67,14 @@ describe NotificationService do end it do - new_note = create(:note_on_commit, - author: @u_participating, - project_id: note.project_id, - commit_id: note.commit_id, - note: '@mention referenced') - - should_email(@u_watcher.id, new_note) - should_email(@u_mentioned.id, new_note) - should_not_email(new_note.author_id, new_note) - should_not_email(@u_participating.id, new_note) - should_not_email(@u_disabled.id, new_note) - notification.new_note(new_note) + note.update_attribute(:note, '@mention referenced') + should_email(@u_committer.id, note) + should_email(@u_watcher.id, note) + should_email(@u_mentioned.id, note) + should_not_email(note.author_id, note) + should_not_email(@u_participating.id, note) + should_not_email(@u_disabled.id, note) + notification.new_note(note) end def should_email(user_id, n) @@ -240,10 +238,12 @@ describe NotificationService do @u_participating = create(:user, notification_level: Notification::N_PARTICIPATING) @u_disabled = create(:user, notification_level: Notification::N_DISABLED) @u_mentioned = create(:user, username: 'mention', notification_level: Notification::N_PARTICIPATING) + @u_committer = create(:user, username: 'committer') project.team << [@u_watcher, :master] project.team << [@u_participating, :master] project.team << [@u_disabled, :master] project.team << [@u_mentioned, :master] + project.team << [@u_committer, :master] end end |