summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/email/message/in_product_marketing_spec.rb
blob: 9ffc4a340a3f688600ebbe6d4deffc5192756640 (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
# 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
        :verify | described_class::Verify
        :trial  | described_class::Trial
        :team   | described_class::Team
      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