diff options
Diffstat (limited to 'spec/lib/feature_spec.rb')
-rw-r--r-- | spec/lib/feature_spec.rb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/lib/feature_spec.rb b/spec/lib/feature_spec.rb index c087931d36a..c86bc36057a 100644 --- a/spec/lib/feature_spec.rb +++ b/spec/lib/feature_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Feature, stub_feature_flags: false do +RSpec.describe Feature, stub_feature_flags: false, feature_category: :shared do include StubVersion before do @@ -154,6 +154,17 @@ RSpec.describe Feature, stub_feature_flags: false do end end + describe '.register_feature_groups' do + before do + Flipper.unregister_groups + described_class.register_feature_groups + end + + it 'registers expected groups' do + expect(Flipper.groups).to include(an_object_having_attributes(name: :gitlab_team_members)) + end + end + describe '.enabled?' do before do allow(Feature).to receive(:log_feature_flag_states?).and_return(false) @@ -350,6 +361,22 @@ RSpec.describe Feature, stub_feature_flags: false do end end + context 'with gitlab_team_members feature group' do + let(:actor) { build_stubbed(:user) } + + before do + Flipper.unregister_groups + described_class.register_feature_groups + described_class.enable(:enabled_feature_flag, :gitlab_team_members) + end + + it 'delegates check to FeatureGroups::GitlabTeamMembers' do + expect(FeatureGroups::GitlabTeamMembers).to receive(:enabled?).with(actor) + + described_class.enabled?(:enabled_feature_flag, actor) + end + end + context 'with an individual actor' do let(:actor) { stub_feature_flag_gate('CustomActor:5') } let(:another_actor) { stub_feature_flag_gate('CustomActor:10') } |