summaryrefslogtreecommitdiff
path: root/spec/models/member_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/member_spec.rb')
-rw-r--r--spec/models/member_spec.rb30
1 files changed, 28 insertions, 2 deletions
diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb
index 9b7a63bffdf..0ebccf1cb65 100644
--- a/spec/models/member_spec.rb
+++ b/spec/models/member_spec.rb
@@ -799,9 +799,35 @@ RSpec.describe Member do
end
describe '#request?' do
- subject { create(:project_member, requested_at: Time.current.utc) }
+ context 'when request for project' do
+ subject { create(:project_member, requested_at: Time.current.utc) }
- it { is_expected.to be_request }
+ it 'calls notification service but not todo service' do
+ expect_next_instance_of(NotificationService) do |instance|
+ expect(instance).to receive(:new_access_request)
+ end
+
+ expect(TodoService).not_to receive(:new)
+
+ is_expected.to be_request
+ end
+ end
+
+ context 'when request for group' do
+ subject { create(:group_member, requested_at: Time.current.utc) }
+
+ it 'calls notification and todo service' do
+ expect_next_instance_of(NotificationService) do |instance|
+ expect(instance).to receive(:new_access_request)
+ end
+
+ expect_next_instance_of(TodoService) do |instance|
+ expect(instance).to receive(:create_member_access_request)
+ end
+
+ is_expected.to be_request
+ end
+ end
end
describe '#pending?' do