summaryrefslogtreecommitdiff
path: root/spec/services/members/create_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/members/create_service_spec.rb')
-rw-r--r--spec/services/members/create_service_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/services/members/create_service_spec.rb b/spec/services/members/create_service_spec.rb
index 13f56fe7458..4d9e69719b4 100644
--- a/spec/services/members/create_service_spec.rb
+++ b/spec/services/members/create_service_spec.rb
@@ -39,6 +39,15 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_
expect(source.users).to include member
expect(OnboardingProgress.completed?(source, :user_added)).to be(true)
end
+
+ it 'triggers a members added event' do
+ expect(Gitlab::EventStore)
+ .to receive(:publish)
+ .with(an_instance_of(Members::MembersAddedEvent))
+ .and_call_original
+
+ expect(execute_service[:status]).to eq(:success)
+ end
end
end
@@ -108,6 +117,24 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_
user: user
)
end
+
+ context 'with an already existing member' do
+ before do
+ source.add_developer(member)
+ end
+
+ it 'tracks the invite source from params' do
+ execute_service
+
+ expect_snowplow_event(
+ category: described_class.name,
+ action: 'create_member',
+ label: '_invite_source_',
+ property: 'existing_user',
+ user: user
+ )
+ end
+ end
end
context 'when it is a net_new_user' do