debian-mirror-gitlab/spec/helpers/groups/crm_settings_helper_spec.rb

48 lines
1 KiB
Ruby
Raw Normal View History

2022-03-02 08:16:31 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Groups::CrmSettingsHelper do
2022-05-07 20:08:51 +05:30
let_it_be(:root_group) { create(:group) }
2022-03-02 08:16:31 +05:30
2022-05-07 20:08:51 +05:30
describe '#crm_feature_available?' do
2022-03-02 08:16:31 +05:30
subject do
2022-05-07 20:08:51 +05:30
helper.crm_feature_available?(group)
2022-03-02 08:16:31 +05:30
end
2022-05-07 20:08:51 +05:30
context 'in root group' do
let(:group) { root_group }
context 'when feature flag is enabled' do
it { is_expected.to be_truthy }
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(customer_relations: false)
end
it { is_expected.to be_falsy }
end
2022-03-02 08:16:31 +05:30
end
2022-05-07 20:08:51 +05:30
context 'in subgroup' do
let_it_be(:subgroup) { create(:group, parent: root_group) }
let(:group) { subgroup }
context 'when feature flag is enabled' do
it { is_expected.to be_truthy }
2022-03-02 08:16:31 +05:30
end
2022-05-07 20:08:51 +05:30
context 'when feature flag is disabled' do
before do
stub_feature_flags(customer_relations: false)
end
it { is_expected.to be_falsy }
end
2022-03-02 08:16:31 +05:30
end
end
end