summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/email/message/in_product_marketing_spec.rb
blob: 40351bef8b935204936232ec0f995e7814ea0fac (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Email::Message::InProductMarketing do
  describe '.for' do
    using RSpec::Parameterized::TableSyntax

    subject { described_class.for(track) }

    context 'when track exists' do
      where(:track, :expected_class) do
        :create       | described_class::Create
        :team_short   | described_class::TeamShort
        :trial_short  | described_class::TrialShort
        :admin_verify | described_class::AdminVerify
        :verify       | described_class::Verify
        :trial        | described_class::Trial
        :team         | described_class::Team
        :experience   | described_class::Experience
      end

      with_them do
        it { is_expected.to eq(expected_class) }
      end
    end

    context 'when track does not exist' do
      let(:track) { :non_existent }

      it 'raises error' do
        expect { subject }.to raise_error(described_class::UnknownTrackError)
      end
    end
  end
end