diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-17 00:06:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-17 00:06:30 +0300 |
commit | 274ea604fcd43ecccfba04756a9475a3efa47de0 (patch) | |
tree | 33b203dedc5e5b980f945bdf01b9f16fe698417d /spec/support/shared_examples/controllers | |
parent | 930ff68c1efc380cb7522aa9b3884842eecb2486 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/controllers')
-rw-r--r-- | spec/support/shared_examples/controllers/application_settings_shared_examples.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/support/shared_examples/controllers/application_settings_shared_examples.rb b/spec/support/shared_examples/controllers/application_settings_shared_examples.rb new file mode 100644 index 00000000000..9619451cd14 --- /dev/null +++ b/spec/support/shared_examples/controllers/application_settings_shared_examples.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +shared_examples 'renders correct panels' do + it 'renders correct action on error' do + expect_next_instance_of(ApplicationSettings::UpdateService) do |service| + allow(service).to receive(:execute).and_return(false) + end + + patch action, params: { application_setting: { unused_param: true } } + + expect(subject).to render_template(action) + end + + it 'redirects to same panel on success' do + expect_next_instance_of(ApplicationSettings::UpdateService) do |service| + allow(service).to receive(:execute).and_return(true) + end + + 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 |