diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-27 18:09:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-27 18:09:52 +0300 |
commit | a2f36202361dcef1f2c9242929f81a4090b9ce97 (patch) | |
tree | ba21b187bf565cde47412e89bb1ccde829672dd9 /spec/requests | |
parent | 154523302b10ab5aeb67bde861880a98e3f8117a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/settings_spec.rb | 28 | ||||
-rw-r--r-- | spec/requests/whats_new_controller_spec.rb | 14 |
2 files changed, 41 insertions, 1 deletions
diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb index 48f5bd114a1..b61ccee512a 100644 --- a/spec/requests/api/settings_spec.rb +++ b/spec/requests/api/settings_spec.rb @@ -45,6 +45,7 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting do expect(json_response['require_admin_approval_after_user_signup']).to eq(true) expect(json_response['personal_access_token_prefix']).to be_nil expect(json_response['admin_mode']).to be(false) + expect(json_response['whats_new_variant']).to eq('all_tiers') end end @@ -485,5 +486,32 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting do end end end + + context 'whats_new_variant setting' do + before do + Gitlab::CurrentSettings.current_application_settings.whats_new_variant_disabled! + end + + it 'updates setting' do + new_value = 'all_tiers' + put api("/application/settings", admin), + params: { + whats_new_variant: new_value + } + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['whats_new_variant']).to eq(new_value) + end + + it 'fails to update setting with invalid value' do + put api("/application/settings", admin), + params: { + whats_new_variant: 'invalid_value' + } + + expect(response).to have_gitlab_http_status(:bad_request) + expect(json_response['error']).to eq('whats_new_variant does not have a valid value') + end + end end end diff --git a/spec/requests/whats_new_controller_spec.rb b/spec/requests/whats_new_controller_spec.rb index ffb31bdf9bb..d4976a2bba3 100644 --- a/spec/requests/whats_new_controller_spec.rb +++ b/spec/requests/whats_new_controller_spec.rb @@ -7,7 +7,7 @@ RSpec.describe WhatsNewController, :clean_gitlab_redis_cache do ReleaseHighlight.instance_variable_set(:@file_paths, nil) end - describe 'whats_new_path' do + describe 'GET #index' do let(:item) { double(:item) } let(:highlights) { double(:highlight, items: [item], map: [item].map, next_page: 2) } @@ -35,5 +35,17 @@ RSpec.describe WhatsNewController, :clean_gitlab_redis_cache do expect(response).to have_gitlab_http_status(:not_found) end end + + context 'with whats_new_variant = disabled' do + before do + Gitlab::CurrentSettings.current_application_settings.whats_new_variant_disabled! + end + + it 'returns a 404' do + get whats_new_path, xhr: true + + expect(response).to have_gitlab_http_status(:not_found) + end + end end end |