summaryrefslogtreecommitdiff
path: root/spec/helpers/one_trust_helper_spec.rb
blob: 20b731ac73db9db0af63482fd8f01327bcf5b0e3 (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
# frozen_string_literal: true

require "spec_helper"

RSpec.describe OneTrustHelper do
  describe '#one_trust_enabled?' do
    before do
      stub_config(extra: { one_trust_id: SecureRandom.uuid })
    end

    subject(:one_trust_enabled?) { helper.one_trust_enabled? }

    context 'with ecomm_instrumentation feature flag disabled' do
      before do
        stub_feature_flags(ecomm_instrumentation: false)
      end

      it { is_expected.to be_falsey }
    end

    context 'with ecomm_instrumentation feature flag enabled' do
      context 'when no id is set' do
        before do
          stub_config(extra: {})
        end

        it { is_expected.to be_falsey }
      end
    end
  end
end