diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/controllers/projects/environments_controller_spec.rb | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/controllers/projects/environments_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/environments_controller_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/controllers/projects/environments_controller_spec.rb b/spec/controllers/projects/environments_controller_spec.rb index dddefbac163..169fed1ab17 100644 --- a/spec/controllers/projects/environments_controller_spec.rb +++ b/spec/controllers/projects/environments_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::EnvironmentsController do +RSpec.describe Projects::EnvironmentsController, feature_category: :continuous_delivery do include MetricsDashboardHelpers include KubernetesHelpers @@ -103,6 +103,24 @@ RSpec.describe Projects::EnvironmentsController do expect(json_response['stopped_count']).to eq 1 end + context 'can access stop stale environments feature' do + it 'maintainers can access the feature' do + get :index, params: environment_params(format: :json) + + expect(json_response['can_stop_stale_environments']).to be_truthy + end + + context 'when user is a reporter' do + let(:user) { reporter } + + it 'reporters cannot access the feature' do + get :index, params: environment_params(format: :json) + + expect(json_response['can_stop_stale_environments']).to be_falsey + end + end + end + context 'when enable_environments_search_within_folder FF is disabled' do before do stub_feature_flags(enable_environments_search_within_folder: false) |