summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 21:06:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 21:06:30 +0000
commit274ea604fcd43ecccfba04756a9475a3efa47de0 (patch)
tree33b203dedc5e5b980f945bdf01b9f16fe698417d /spec
parent930ff68c1efc380cb7522aa9b3884842eecb2486 (diff)
downloadgitlab-ce-274ea604fcd43ecccfba04756a9475a3efa47de0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/admin/application_settings_controller_spec.rb27
-rw-r--r--spec/features/admin/admin_disables_git_access_protocol_spec.rb5
-rw-r--r--spec/features/admin/admin_settings_spec.rb2
-rw-r--r--spec/frontend/fixtures/application_settings.rb2
-rw-r--r--spec/javascripts/test_bundle.js2
-rw-r--r--spec/support/shared_examples/controllers/application_settings_shared_examples.rb26
6 files changed, 35 insertions, 29 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb
index 4eb0545eb6c..d62e0a97609 100644
--- a/spec/controllers/admin/application_settings_controller_spec.rb
+++ b/spec/controllers/admin/application_settings_controller_spec.rb
@@ -118,32 +118,7 @@ describe Admin::ApplicationSettingsController do
end
describe 'verify panel actions' do
- 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
-
- (Admin::ApplicationSettingsController::VALID_SETTING_PANELS - %w(show templates geo)).each do |valid_action|
+ (Admin::ApplicationSettingsController::VALID_SETTING_PANELS - %w(templates geo)).each do |valid_action|
it_behaves_like 'renders correct panels' do
let(:action) { valid_action }
end
diff --git a/spec/features/admin/admin_disables_git_access_protocol_spec.rb b/spec/features/admin/admin_disables_git_access_protocol_spec.rb
index 4c3c0904a06..bc757d72a49 100644
--- a/spec/features/admin/admin_disables_git_access_protocol_spec.rb
+++ b/spec/features/admin/admin_disables_git_access_protocol_spec.rb
@@ -76,6 +76,7 @@ describe 'Admin disables Git access protocol', :js do
context 'with nothing disabled' do
before do
create(:personal_key, user: admin)
+ allow_all_protocols
end
it 'shows default SSH url and protocol selection dropdown' do
@@ -107,6 +108,10 @@ describe 'Admin disables Git access protocol', :js do
visit project_path(project)
end
+ def allow_all_protocols
+ switch_git_protocol(1)
+ end
+
def disable_http_protocol
switch_git_protocol(2)
end
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb
index be34315118d..ab58d9fb9d5 100644
--- a/spec/features/admin/admin_settings_spec.rb
+++ b/spec/features/admin/admin_settings_spec.rb
@@ -15,7 +15,7 @@ describe 'Admin updates settings' do
context 'General page' do
before do
- visit admin_application_settings_path
+ visit general_admin_application_settings_path
end
it 'Change visibility settings' do
diff --git a/spec/frontend/fixtures/application_settings.rb b/spec/frontend/fixtures/application_settings.rb
index 38a060580c1..afe5949ed3b 100644
--- a/spec/frontend/fixtures/application_settings.rb
+++ b/spec/frontend/fixtures/application_settings.rb
@@ -26,7 +26,7 @@ describe Admin::ApplicationSettingsController, '(JavaScript fixtures)', type: :c
it 'application_settings/accounts_and_limit.html' do
stub_application_setting(user_default_external: false)
- get :show
+ get :general
expect(response).to be_successful
end
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js
index ce453d7c483..c0a999cfaa6 100644
--- a/spec/javascripts/test_bundle.js
+++ b/spec/javascripts/test_bundle.js
@@ -210,7 +210,7 @@ if (process.env.BABEL_ENV === 'coverage') {
'./terminal/terminal_bundle.js',
'./users/users_bundle.js',
'./issue_show/index.js',
- './pages/admin/application_settings/show/index.js',
+ './pages/admin/application_settings/general/index.js',
];
describe('Uncovered files', function() {
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