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

bizible_helper_spec.rb « helpers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c1b79a8e1e2dc646a09e0fdc01037d9b8698ffb3 (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
40
41
42
43
44
45
46
47
# frozen_string_literal: true

require "spec_helper"

RSpec.describe BizibleHelper do
  describe '#bizible_enabled?' do
    context 'when bizible config is not true' do
      before do
        stub_config(extra: { bizible: false })
      end

      it { expect(helper.bizible_enabled?).to be_falsy }
    end

    context 'when bizible config is enabled' do
      before do
        stub_config(extra: { bizible: true })
      end

      it { expect(helper.bizible_enabled?).to be_truthy }

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

        it { expect(helper.bizible_enabled?).to be_falsey }
      end

      context 'with ecomm_instrumentation feature flag enabled' do
        before do
          stub_feature_flags(ecomm_instrumentation: true)
        end

        it { expect(helper.bizible_enabled?).to be_truthy }
      end

      context 'with invite_email present' do
        before do
          stub_feature_flags(ecomm_instrumentation: true)
        end

        it { expect(helper.bizible_enabled?('test@test.com')).to be_falsy }
      end
    end
  end
end