Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/feature_flags/user_updates_feature_flag_spec.rb')
-rw-r--r--spec/features/projects/feature_flags/user_updates_feature_flag_spec.rb117
1 files changed, 5 insertions, 112 deletions
diff --git a/spec/features/projects/feature_flags/user_updates_feature_flag_spec.rb b/spec/features/projects/feature_flags/user_updates_feature_flag_spec.rb
index bc2d63e1953..a435e565ff1 100644
--- a/spec/features/projects/feature_flags/user_updates_feature_flag_spec.rb
+++ b/spec/features/projects/feature_flags/user_updates_feature_flag_spec.rb
@@ -14,8 +14,7 @@ RSpec.describe 'User updates feature flag', :js do
before do
stub_feature_flags(
- feature_flag_permissions: false,
- feature_flags_legacy_read_only_override: false
+ feature_flag_permissions: false
)
sign_in(user)
end
@@ -79,117 +78,11 @@ RSpec.describe 'User updates feature flag', :js do
let!(:scope) { create_scope(feature_flag, 'review/*', true) }
- context 'when legacy flags are editable' do
- before do
- stub_feature_flags(feature_flags_legacy_read_only: false)
-
- visit(edit_project_feature_flag_path(project, feature_flag))
- end
-
- it 'user sees persisted default scope' do
- within_scope_row(1) do
- within_environment_spec do
- expect(page).to have_content('* (All Environments)')
- end
-
- within_status do
- expect(find('.project-feature-toggle')['aria-label'])
- .to eq('Toggle Status: ON')
- end
- end
- end
-
- context 'when user updates the status of a scope' do
- before do
- within_scope_row(2) do
- within_status { find('.project-feature-toggle').click }
- end
-
- click_button 'Save changes'
- expect(page).to have_current_path(project_feature_flags_path(project))
- end
-
- it 'shows the updated feature flag' do
- within_feature_flag_row(1) do
- expect(page.find('.feature-flag-name')).to have_content('ci_live_trace')
- expect_status_toggle_button_to_be_checked
-
- within_feature_flag_scopes do
- expect(page.find('.badge:nth-child(1)')).to have_content('*')
- expect(page.find('.badge:nth-child(1)')['class']).to include('badge-info')
- expect(page.find('.badge:nth-child(2)')).to have_content('review/*')
- expect(page.find('.badge:nth-child(2)')['class']).to include('badge-muted')
- end
- end
- end
- end
-
- context 'when user adds a new scope' do
- before do
- within_scope_row(3) do
- within_environment_spec do
- find('.js-env-search > input').set('production')
- find('.js-create-button').click
- end
- end
-
- click_button 'Save changes'
- expect(page).to have_current_path(project_feature_flags_path(project))
- end
-
- it 'shows the newly created scope' do
- within_feature_flag_row(1) do
- within_feature_flag_scopes do
- expect(page.find('.badge:nth-child(3)')).to have_content('production')
- expect(page.find('.badge:nth-child(3)')['class']).to include('badge-muted')
- end
- end
- end
- end
-
- context 'when user deletes a scope' do
- before do
- within_scope_row(2) do
- within_delete { find('.js-delete-scope').click }
- end
-
- click_button 'Save changes'
- expect(page).to have_current_path(project_feature_flags_path(project))
- end
-
- it 'shows the updated feature flag' do
- within_feature_flag_row(1) do
- within_feature_flag_scopes do
- expect(page).to have_css('.badge:nth-child(1)')
- expect(page).not_to have_css('.badge:nth-child(2)')
- end
- end
- end
- end
- end
-
- context 'when legacy flags are read-only' do
- it 'the user cannot edit the flag' do
- visit(edit_project_feature_flag_path(project, feature_flag))
-
- expect(page).to have_text 'This feature flag is read-only, and it will be removed in 14.0.'
- expect(page).to have_css('button.js-ff-submit.disabled')
- end
- end
-
- context 'when legacy flags are read-only, but the override is active for one project' do
- it 'the user can edit the flag' do
- stub_feature_flags(feature_flags_legacy_read_only_override: project)
-
- visit(edit_project_feature_flag_path(project, feature_flag))
- status_toggle_button.click
- click_button 'Save changes'
+ it 'the user cannot edit the flag' do
+ visit(edit_project_feature_flag_path(project, feature_flag))
- expect(page).to have_current_path(project_feature_flags_path(project))
- within_feature_flag_row(1) do
- expect_status_toggle_button_not_to_be_checked
- end
- end
+ expect(page).to have_text 'This feature flag is read-only, and it will be removed in 14.0.'
+ expect(page).to have_css('button.js-ff-submit.disabled')
end
end
end