2022-04-04 11:22:00 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "spec_helper"
|
|
|
|
|
|
|
|
RSpec.describe BizibleHelper do
|
|
|
|
describe '#bizible_enabled?' do
|
2023-04-23 21:23:45 +05:30
|
|
|
context 'when bizible config is not true' do
|
2022-04-04 11:22:00 +05:30
|
|
|
before do
|
2023-04-23 21:23:45 +05:30
|
|
|
stub_config(extra: { bizible: false })
|
2022-04-04 11:22:00 +05:30
|
|
|
end
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
it { expect(helper.bizible_enabled?).to be_falsy }
|
2022-04-04 11:22:00 +05:30
|
|
|
end
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
context 'when bizible config is enabled' do
|
2022-04-04 11:22:00 +05:30
|
|
|
before do
|
2023-04-23 21:23:45 +05:30
|
|
|
stub_config(extra: { bizible: true })
|
2022-04-04 11:22:00 +05:30
|
|
|
end
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
it { expect(helper.bizible_enabled?).to be_truthy }
|
2022-04-04 11:22:00 +05:30
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
context 'with ecomm_instrumentation feature flag disabled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(ecomm_instrumentation: false)
|
|
|
|
end
|
2022-04-04 11:22:00 +05:30
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
it { expect(helper.bizible_enabled?).to be_falsey }
|
2022-04-04 11:22:00 +05:30
|
|
|
end
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
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
|
2022-04-04 11:22:00 +05:30
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
context 'with invite_email present' do
|
2022-04-04 11:22:00 +05:30
|
|
|
before do
|
2023-04-23 21:23:45 +05:30
|
|
|
stub_feature_flags(ecomm_instrumentation: true)
|
2022-04-04 11:22:00 +05:30
|
|
|
end
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
it { expect(helper.bizible_enabled?('test@test.com')).to be_falsy }
|
2022-04-04 11:22:00 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|