diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
commit | be834a25982746ffd85252ff502df42bb88cb9d5 (patch) | |
tree | b4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /spec/mailers/notify_spec.rb | |
parent | ee925a3597f27e92f83a50937a64068109675b3d (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
Diffstat (limited to 'spec/mailers/notify_spec.rb')
-rw-r--r-- | spec/mailers/notify_spec.rb | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index b9f95a9eb00..fa03c374633 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -1508,12 +1508,44 @@ RSpec.describe Notify do ) end - describe 'group invitation' do + describe 'invitations' do let(:owner) { create(:user).tap { |u| group.add_user(u, Gitlab::Access::OWNER) } } let(:group_member) { invite_to_group(group, inviter: inviter) } let(:inviter) { owner } - subject { described_class.member_invited_email('group', group_member.id, group_member.invite_token) } + subject { described_class.member_invited_email('Group', group_member.id, group_member.invite_token) } + + shared_examples "tracks the 'sent' 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, group_member.invite_email).and_return(experimental_group) + end + + it "tracks the 'sent' event", :snowplow do + subject.deliver_now + + expect_snowplow_event( + category: 'Growth::Acquisition::Experiment::InvitationReminders', + label: Digest::MD5.hexdigest(group_member.to_global_id.to_s), + property: experimental_group ? 'experimental_group' : 'control_group', + action: 'sent' + ) + end + end + + describe 'tracking for the invitation reminders experiment' do + context 'when invite email is in the experimental group' do + let(:experimental_group) { true } + + it_behaves_like "tracks the 'sent' event for the invitation reminders experiment" + end + + context 'when invite email is in the control group' do + let(:experimental_group) { false } + + it_behaves_like "tracks the 'sent' event for the invitation reminders experiment" + end + end context 'when invite_email_experiment is disabled' do before do |