summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-04 00:09:37 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-04 00:09:37 +0000
commite3bdfa1a13d7e6c92716324c78b5b20c07eeb7c6 (patch)
treee8776263096b027d32d4be5118cccc87b00de2bc /spec/controllers
parentc1a50b8195f4e36fda9b233acbde57a449bcf6c3 (diff)
downloadgitlab-ce-e3bdfa1a13d7e6c92716324c78b5b20c07eeb7c6.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin/integrations_controller_spec.rb34
-rw-r--r--spec/controllers/groups/settings/integrations_controller_spec.rb35
2 files changed, 7 insertions, 62 deletions
diff --git a/spec/controllers/admin/integrations_controller_spec.rb b/spec/controllers/admin/integrations_controller_spec.rb
index 50748918893..8e48ecddd0f 100644
--- a/spec/controllers/admin/integrations_controller_spec.rb
+++ b/spec/controllers/admin/integrations_controller_spec.rb
@@ -3,7 +3,6 @@
require 'spec_helper'
describe Admin::IntegrationsController do
- let_it_be(:project) { create(:project) }
let(:admin) { create(:admin) }
before do
@@ -34,7 +33,7 @@ describe Admin::IntegrationsController do
end
describe '#update' do
- let(:integration) { create(:jira_service, project: project) }
+ let(:integration) { create(:jira_service, :instance) }
before do
put :update, params: { id: integration.class.to_param, service: { url: url } }
@@ -52,34 +51,9 @@ describe Admin::IntegrationsController do
context 'invalid params' do
let(:url) { 'https://jira.localhost' }
- it 'does not update the integration' do
- expect(response).to have_gitlab_http_status(:ok)
- expect(response).to render_template(:edit)
- expect(integration.reload.url).not_to eq(url)
- end
- end
- end
-
- describe '#test' do
- context 'testable' do
- let(:integration) { create(:jira_service, project: project) }
-
- it 'returns ok' do
- allow_any_instance_of(integration.class).to receive(:test) { { success: true } }
-
- put :test, params: { id: integration.class.to_param }
-
- expect(response).to have_gitlab_http_status(:ok)
- end
- end
-
- context 'not testable' do
- let(:integration) { create(:alerts_service, project: project) }
-
- it 'returns not found' do
- put :test, params: { id: integration.class.to_param }
-
- expect(response).to have_gitlab_http_status(:not_found)
+ it 'updates the integration' do
+ expect(response).to have_gitlab_http_status(:found)
+ expect(integration.reload.url).to eq(url)
end
end
end
diff --git a/spec/controllers/groups/settings/integrations_controller_spec.rb b/spec/controllers/groups/settings/integrations_controller_spec.rb
index bbf215a4bb9..eee65476dab 100644
--- a/spec/controllers/groups/settings/integrations_controller_spec.rb
+++ b/spec/controllers/groups/settings/integrations_controller_spec.rb
@@ -67,40 +67,11 @@ describe Groups::Settings::IntegrationsController do
end
context 'invalid params' do
- let(:url) { 'ftp://jira.localhost' }
+ let(:url) { 'https://jira.localhost' }
it 'does not update the integration' do
- expect(response).to have_gitlab_http_status(:ok)
- expect(response).to render_template(:edit)
- expect(integration.reload.url).not_to eq(url)
- end
- end
- end
-
- describe '#test' do
- context 'testable' do
- let(:integration) { create(:jira_service, project: project) }
-
- before do
- group.add_owner(user)
- end
-
- it 'returns ok' do
- allow_any_instance_of(integration.class).to receive(:test) { { success: true } }
-
- put :test, params: { group_id: group, id: integration.class.to_param }
-
- expect(response).to have_gitlab_http_status(:ok)
- end
- end
-
- context 'not testable' do
- let(:integration) { create(:alerts_service, project: project) }
-
- it 'returns not found' do
- put :test, params: { group_id: group, id: integration.class.to_param }
-
- expect(response).to have_gitlab_http_status(:not_found)
+ expect(response).to have_gitlab_http_status(:found)
+ expect(integration.reload.url).to eq(url)
end
end
end