Commit 2b0812b2 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '214664-fix-beta-feature-check' into 'master'

Resolve "Make Group level activity analytics available for Bronze and above tiers on gitlab.com"

Closes #214664

See merge request gitlab-org/gitlab!31621
parents 0b63523b d2084e45
......@@ -111,8 +111,7 @@ module EE
# it. This is the case when we're ready to enable a feature for anyone
# with the correct license.
def beta_feature_available?(feature)
::Feature.enabled?(feature, self) ||
(::Feature.enabled?(feature) && feature_available?(feature))
::Feature.enabled?(feature) ? feature_available?(feature) : ::Feature.enabled?(feature, self)
end
alias_method :alpha_feature_available?, :beta_feature_available?
......
......@@ -303,8 +303,7 @@ module EE
# it. This is the case when we're ready to enable a feature for anyone
# with the correct license.
def beta_feature_available?(feature)
::Feature.enabled?(feature, self) ||
(::Feature.enabled?(feature) && feature_available?(feature))
::Feature.enabled?(feature) ? feature_available?(feature) : ::Feature.enabled?(feature, self)
end
alias_method :alpha_feature_available?, :beta_feature_available?
......
......@@ -12,23 +12,22 @@ RSpec.shared_examples 'an entity with alpha/beta feature support' do
stub_licensed_features(insights: false)
end
context 'when the feature flag is disabled globally' do
context 'when the feature flag is enabled globally' do
before do
stub_feature_flags(insights: false)
stub_feature_flags(insights: true)
end
it { expect(entity.public_send(method_name, :insights)).to be_falsy }
end
context 'when the feature flag is enabled globally' do
context 'when the feature flag is disabled globally' do
before do
stub_feature_flags(insights: true)
stub_feature_flags(insights: false)
end
it { expect(entity.public_send(method_name, :insights)).to be_truthy }
end
it { expect(entity.public_send(method_name, :insights)).to be_falsy }
context 'when the feature flag is enabled for the entity' do
context 'and enabled for the entity' do
before do
stub_feature_flags(insights: { enabled: true, thing: entity })
end
......@@ -36,29 +35,29 @@ RSpec.shared_examples 'an entity with alpha/beta feature support' do
it { expect(entity.public_send(method_name, :insights)).to be_truthy }
end
end
end
context 'when license allows it' do
before do
stub_licensed_features(insights: true)
end
context 'when the feature flag is disabled globally' do
context 'when the feature flag is enabled globally' do
before do
stub_feature_flags(insights: false)
stub_feature_flags(insights: true)
end
it { expect(entity.public_send(method_name, :insights)).to be_falsy }
it { expect(entity.public_send(method_name, :insights)).to be_truthy }
end
context 'when the feature flag is enabled globally' do
context 'when the feature flag is disabled globally' do
before do
stub_feature_flags(insights: true)
stub_feature_flags(insights: false)
end
it { expect(entity.public_send(method_name, :insights)).to be_truthy }
end
it { expect(entity.public_send(method_name, :insights)).to be_falsy }
context 'when the feature flag is enabled for the entity' do
context 'and enabled for the entity' do
before do
stub_feature_flags(insights: { enabled: true, thing: entity })
end
......@@ -67,4 +66,5 @@ RSpec.shared_examples 'an entity with alpha/beta feature support' do
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment