diff options
| author | Sean McGivern <sean@gitlab.com> | 2019-06-20 14:43:47 +0000 |
|---|---|---|
| committer | Sean McGivern <sean@gitlab.com> | 2019-06-20 14:43:47 +0000 |
| commit | c6eb18ee0fe1b887438da87f25fc2f2a852dd393 (patch) | |
| tree | 71e4e35697da7355ebd6f9b4ea9bfe8efd396b2a /spec/controllers | |
| parent | 7fed708c146fd9937e334d4e7639c6c81c7d164c (diff) | |
| parent | 6b4f93c0349e9d54cb48f1d5cf025c5e5ce77aee (diff) | |
| download | gitlab-ce-c6eb18ee0fe1b887438da87f25fc2f2a852dd393.tar.gz | |
Merge branch '57973-errors-in-application-settings-panel-shows-wrong-panel' into 'master'
Errors in application settings panel shows wrong panel
See merge request gitlab-org/gitlab-ce!25434
Diffstat (limited to 'spec/controllers')
| -rw-r--r-- | spec/controllers/admin/application_settings_controller_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index b89348b7a7e..c7f814c58c0 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -116,6 +116,34 @@ describe Admin::ApplicationSettingsController do end end end + + describe 'verify panel actions' do + shared_examples 'renders correct panels' do + it 'renders correct action on error' do + allow_any_instance_of(ApplicationSettings::UpdateService).to receive(:execute).and_return(false) + + patch action, params: { application_setting: { unused_param: true } } + + expect(subject).to render_template(action) + end + + it 'redirects to same panel on success' do + allow_any_instance_of(ApplicationSettings::UpdateService).to receive(:execute).and_return(true) + referer_path = public_send("#{action}_admin_application_settings_path") + request.env["HTTP_REFERER"] = referer_path + + patch action, params: { application_setting: { unused_param: true } } + + expect(subject).to redirect_to(referer_path) + end + end + + (Admin::ApplicationSettingsController::VALID_SETTING_PANELS - %w(show templates geo)).each do |valid_action| + it_behaves_like 'renders correct panels' do + let(:action) { valid_action } + end + end + end end describe 'PUT #reset_registration_token' do |
