Commit cfb23600 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch 'pedropombeiro/335815/graphql-use-default_enabled-yaml' into 'master'

Use YAML default state in GraphQL feature flags

See merge request gitlab-org/gitlab!65952
parents 5f711ce0 231887f4
......@@ -65,7 +65,7 @@ module Types
end
def visible?(context)
return false if feature_flag.present? && !Feature.enabled?(feature_flag)
return false if feature_flag.present? && !Feature.enabled?(feature_flag, default_enabled: :yaml)
super
end
......
......@@ -28,6 +28,16 @@ RSpec.describe 'Graphql Field feature flags' do
end
end
it 'checks YAML definition for default_enabled' do
# Exception is indicative of a check for YAML definition
expect { subject }.to raise_error(Feature::InvalidFeatureFlagError, /The feature flag YAML definition for '#{feature_flag}' does not exist/)
end
context 'skipping YAML check' do
before do
skip_default_enabled_yaml_check
end
it 'returns the value when feature is enabled' do
expect(subject['item']).to eq('name' => test_object.name)
end
......@@ -38,4 +48,5 @@ RSpec.describe 'Graphql Field feature flags' do
expect(subject).to be_nil
end
end
end
end
......@@ -130,6 +130,16 @@ RSpec.describe Types::BaseField do
skip_feature_flags_yaml_validation
end
it 'checks YAML definition for default_enabled' do
# Exception is indicative of a check for YAML definition
expect { field.visible?(context) }.to raise_error(Feature::InvalidFeatureFlagError, /The feature flag YAML definition for '#{flag}' does not exist/)
end
context 'skipping YAML check' do
before do
skip_default_enabled_yaml_check
end
it 'returns false if the feature is not enabled' do
stub_feature_flags(flag => false)
......@@ -142,6 +152,7 @@ RSpec.describe Types::BaseField do
end
end
end
end
describe '#description' do
context 'feature flag given' do
......
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