diff options
author | http://jneen.net/ <jneen@jneen.net> | 2017-08-10 20:40:55 +0300 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2017-08-12 02:02:07 +0300 |
commit | 4a3b18cbd87a49464d2a7619113a7b192f08a98b (patch) | |
tree | c4afbd5a16a02a573401c4597993033d9596b32e /spec/services/notification_service_spec.rb | |
parent | b0600b01563a7bfb09ae01f70c0f052c200b8f4c (diff) |
move the member spec to be with the other ones
and add one
Diffstat (limited to 'spec/services/notification_service_spec.rb')
-rw-r--r-- | spec/services/notification_service_spec.rb | 82 |
1 files changed, 52 insertions, 30 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index 63639fd7db1..8886c71aa5b 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -472,36 +472,6 @@ describe NotificationService, :mailer do end end - describe 'Members' do - let(:group) { create(:group) } - let(:project) { create(:project, :public, namespace: group) } - let(:added_user) { create(:user) } - - def create_member! - GroupMember.create( - group: group, - user: added_user, - access_level: Gitlab::Access::GUEST - ) - end - - it 'sends a notification' do - create_member! - should_only_email(added_user) - end - - describe 'when notifications are disabled' do - before do - create_global_setting_for(added_user, :disabled) - end - - it 'does not send a notification' do - create_member! - should_not_email_anyone - end - end - end - describe 'Issues' do let(:group) { create(:group) } let(:project) { create(:project, :public, namespace: group) } @@ -1267,6 +1237,35 @@ describe NotificationService, :mailer do end.to change { ActionMailer::Base.deliveries.size }.by(1) end end + + describe '#new_group_member' do + let(:group) { create(:group) } + let(:added_user) { create(:user) } + + def create_member! + GroupMember.create( + group: group, + user: added_user, + access_level: Gitlab::Access::GUEST + ) + end + + it 'sends a notification' do + create_member! + should_only_email(added_user) + end + + describe 'when notifications are disabled' do + before do + create_global_setting_for(added_user, :disabled) + end + + it 'does not send a notification' do + create_member! + should_not_email_anyone + end + end + end end describe 'ProjectMember' do @@ -1286,6 +1285,29 @@ describe NotificationService, :mailer do end.to change { ActionMailer::Base.deliveries.size }.by(1) end end + + describe '#new_project_member' do + let(:project) { create(:project) } + let(:added_user) { create(:user) } + + def create_member! + create(:project_member, user: added_user, project: project) + end + + it do + create_member! + should_only_email(added_user) + end + + describe 'when notifications are disabled' do + before { create_global_setting_for(added_user, :disabled) } + + it do + create_member! + should_not_email_anyone + end + end + end end context 'guest user in private project' do |