Welcome to mirror list, hosted at ThFree Co, Russian Federation.

member_invitation_reminder_emails_worker_spec.rb « workers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bfd08792c7cac372af009312f1368787edc7e4ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe MemberInvitationReminderEmailsWorker do
  describe '#perform' do
    subject { described_class.new.perform }

    before do
      create(:group_member, :invited, created_at: 2.days.ago)
    end

    context 'feature flag disabled' do
      before do
        stub_experiment(invitation_reminders: false)
      end

      it 'does not attempt to execute the invitation reminder service' do
        expect(Members::InvitationReminderEmailService).not_to receive(:new)

        subject
      end
    end

    context 'feature flag enabled' do
      before do
        stub_experiment(invitation_reminders: true)
      end

      it 'executes the invitation reminder email service' do
        expect_next_instance_of(Members::InvitationReminderEmailService) do |service|
          expect(service).to receive(:execute)
        end

        subject
      end
    end
  end
end