diff options
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/notification_service_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index 0f6c2604984..68ac3a00ab0 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -2167,6 +2167,39 @@ describe NotificationService, :mailer do end end + context 'Remote mirror notifications' do + describe '#remote_mirror_update_failed' do + let(:project) { create(:project) } + let(:remote_mirror) { create(:remote_mirror, project: project) } + let(:u_blocked) { create(:user, :blocked) } + let(:u_silence) { create_user_with_notification(:disabled, 'silent-maintainer', project) } + let(:u_owner) { project.owner } + let(:u_maintainer1) { create(:user) } + let(:u_maintainer2) { create(:user) } + let(:u_developer) { create(:user) } + + before do + project.add_maintainer(u_blocked) + project.add_maintainer(u_silence) + project.add_maintainer(u_maintainer1) + project.add_maintainer(u_maintainer2) + project.add_developer(u_developer) + + # Mock remote update + allow(project.repository).to receive(:async_remove_remote) + allow(project.repository).to receive(:add_remote) + + reset_delivered_emails! + end + + it 'emails current watching maintainers' do + notification.remote_mirror_update_failed(remote_mirror) + + should_only_email(u_maintainer1, u_maintainer2, u_owner) + end + end + end + def build_team(project) @u_watcher = create_global_setting_for(create(:user), :watch) @u_participating = create_global_setting_for(create(:user), :participating) |