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 ...@@ -111,8 +111,7 @@ module EE
# it. This is the case when we're ready to enable a feature for anyone # it. This is the case when we're ready to enable a feature for anyone
# with the correct license. # with the correct license.
def beta_feature_available?(feature) def beta_feature_available?(feature)
::Feature.enabled?(feature, self) || ::Feature.enabled?(feature) ? feature_available?(feature) : ::Feature.enabled?(feature, self)
(::Feature.enabled?(feature) && feature_available?(feature))
end end
alias_method :alpha_feature_available?, :beta_feature_available? alias_method :alpha_feature_available?, :beta_feature_available?
......
...@@ -303,8 +303,7 @@ module EE ...@@ -303,8 +303,7 @@ module EE
# it. This is the case when we're ready to enable a feature for anyone # it. This is the case when we're ready to enable a feature for anyone
# with the correct license. # with the correct license.
def beta_feature_available?(feature) def beta_feature_available?(feature)
::Feature.enabled?(feature, self) || ::Feature.enabled?(feature) ? feature_available?(feature) : ::Feature.enabled?(feature, self)
(::Feature.enabled?(feature) && feature_available?(feature))
end end
alias_method :alpha_feature_available?, :beta_feature_available? alias_method :alpha_feature_available?, :beta_feature_available?
......
...@@ -12,28 +12,28 @@ RSpec.shared_examples 'an entity with alpha/beta feature support' do ...@@ -12,28 +12,28 @@ RSpec.shared_examples 'an entity with alpha/beta feature support' do
stub_licensed_features(insights: false) stub_licensed_features(insights: false)
end end
context 'when the feature flag is disabled globally' do context 'when the feature flag is enabled globally' do
before do before do
stub_feature_flags(insights: false) stub_feature_flags(insights: true)
end end
it { expect(entity.public_send(method_name, :insights)).to be_falsy } it { expect(entity.public_send(method_name, :insights)).to be_falsy }
end end
context 'when the feature flag is enabled globally' do context 'when the feature flag is disabled globally' do
before do before do
stub_feature_flags(insights: true) stub_feature_flags(insights: false)
end end
it { expect(entity.public_send(method_name, :insights)).to be_truthy } it { expect(entity.public_send(method_name, :insights)).to be_falsy }
end
context 'when the feature flag is enabled for the entity' do context 'and enabled for the entity' do
before do before do
stub_feature_flags(insights: { enabled: true, thing: entity }) stub_feature_flags(insights: { enabled: true, thing: entity })
end end
it { expect(entity.public_send(method_name, :insights)).to be_truthy } it { expect(entity.public_send(method_name, :insights)).to be_truthy }
end
end end
end end
...@@ -42,14 +42,6 @@ RSpec.shared_examples 'an entity with alpha/beta feature support' do ...@@ -42,14 +42,6 @@ RSpec.shared_examples 'an entity with alpha/beta feature support' do
stub_licensed_features(insights: true) stub_licensed_features(insights: true)
end end
context 'when the feature flag is disabled globally' do
before do
stub_feature_flags(insights: false)
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 enabled globally' do
before do before do
stub_feature_flags(insights: true) stub_feature_flags(insights: true)
...@@ -58,12 +50,20 @@ RSpec.shared_examples 'an entity with alpha/beta feature support' do ...@@ -58,12 +50,20 @@ RSpec.shared_examples 'an entity with alpha/beta feature support' do
it { expect(entity.public_send(method_name, :insights)).to be_truthy } it { expect(entity.public_send(method_name, :insights)).to be_truthy }
end end
context 'when the feature flag is enabled for the entity' do context 'when the feature flag is disabled globally' do
before do before do
stub_feature_flags(insights: { enabled: true, thing: entity }) stub_feature_flags(insights: false)
end end
it { expect(entity.public_send(method_name, :insights)).to be_truthy } it { expect(entity.public_send(method_name, :insights)).to be_falsy }
context 'and enabled for the entity' do
before do
stub_feature_flags(insights: { enabled: true, thing: entity })
end
it { expect(entity.public_send(method_name, :insights)).to be_truthy }
end
end 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