diff options
Diffstat (limited to 'spec/controllers/invites_controller_spec.rb')
-rw-r--r-- | spec/controllers/invites_controller_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb index 73be4f97e6a..5f13781f893 100644 --- a/spec/controllers/invites_controller_spec.rb +++ b/spec/controllers/invites_controller_spec.rb @@ -29,6 +29,43 @@ RSpec.describe InvitesController, :snowplow do end end + shared_examples "tracks the 'accepted' event for the invitation reminders experiment" do + before do + stub_experiment(invitation_reminders: true) + allow(Gitlab::Experimentation).to receive(:enabled_for_attribute?).with(:invitation_reminders, member.invite_email).and_return(experimental_group) + end + + context 'when in the control group' do + let(:experimental_group) { false } + + it "tracks the 'accepted' event" do + request + + expect_snowplow_event( + category: 'Growth::Acquisition::Experiment::InvitationReminders', + label: md5_member_global_id, + property: 'control_group', + action: 'accepted' + ) + end + end + + context 'when in the experimental group' do + let(:experimental_group) { true } + + it "tracks the 'accepted' event" do + request + + expect_snowplow_event( + category: 'Growth::Acquisition::Experiment::InvitationReminders', + label: md5_member_global_id, + property: 'experimental_group', + action: 'accepted' + ) + end + end + end + describe 'GET #show' do subject(:request) { get :show, params: params } @@ -89,6 +126,7 @@ RSpec.describe InvitesController, :snowplow do end end + it_behaves_like "tracks the 'accepted' event for the invitation reminders experiment" it_behaves_like 'invalid token' end @@ -150,6 +188,7 @@ RSpec.describe InvitesController, :snowplow do end end + it_behaves_like "tracks the 'accepted' event for the invitation reminders experiment" it_behaves_like 'invalid token' end |