diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-01 09:09:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-01 09:09:36 +0000 |
commit | 8ef03669283030d0502a871113f8db013e6ac46c (patch) | |
tree | beea5b086924cdea8846f4660613368019cf0115 /spec/requests/api/unleash_spec.rb | |
parent | b7ff336e241d1ece19498218f670041b16f62b1c (diff) | |
download | gitlab-ce-8ef03669283030d0502a871113f8db013e6ac46c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/unleash_spec.rb')
-rw-r--r-- | spec/requests/api/unleash_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/requests/api/unleash_spec.rb b/spec/requests/api/unleash_spec.rb index 0b70d62b093..d3d193ba052 100644 --- a/spec/requests/api/unleash_spec.rb +++ b/spec/requests/api/unleash_spec.rb @@ -590,6 +590,32 @@ RSpec.describe API::Unleash do }] }]) end + + it 'returns new flags when legacy flags are disabled' do + stub_feature_flags(remove_legacy_flags_override: false, remove_legacy_flags: true) + + feature_flag_a = create(:operations_feature_flag, :new_version_flag, project: project, + name: 'feature_a', active: true) + strategy = create(:operations_strategy, feature_flag: feature_flag_a, + name: 'userWithId', parameters: { userIds: 'user8' }) + create(:operations_scope, strategy: strategy, environment_scope: 'staging') + feature_flag_b = create(:operations_feature_flag, :legacy_flag, project: project, + name: 'feature_b', active: true) + create(:operations_feature_flag_scope, feature_flag: feature_flag_b, + active: true, strategies: [{ name: 'default', parameters: {} }], environment_scope: 'staging') + + get api(features_url), headers: { 'UNLEASH-INSTANCEID' => client.token, 'UNLEASH-APPNAME' => 'staging' } + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['features'].sort_by {|f| f['name']}).to eq([{ + 'name' => 'feature_a', + 'enabled' => true, + 'strategies' => [{ + 'name' => 'userWithId', + 'parameters' => { 'userIds' => 'user8' } + }] + }]) + end end end end |