Commit 53118659 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch 'ld-move-integrations-specs' into 'master'

Move Integrations feature specs from /services to /integrations

See merge request gitlab-org/gitlab!80130
parents 43d680b3 3616ac8f
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Prometheus custom metrics', :js do
include PrometheusHelpers
include_context 'project service activation'
include_context 'project integration activation'
let!(:prometheus_metric) { create(:prometheus_metric, project: project) }
......
......@@ -2,8 +2,8 @@
require 'spec_helper'
RSpec.describe 'User activates GitHub Service' do
include_context 'project service activation'
RSpec.describe 'User activates GitHub integration' do
include_context 'project integration activation'
context 'without a license' do
it "is excluded from the integrations index" do
......@@ -12,7 +12,7 @@ RSpec.describe 'User activates GitHub Service' do
expect(page).not_to have_link('GitHub')
end
it 'renders 404 when trying to access service settings directly' do
it 'renders 404 when trying to access integration settings directly' do
visit edit_project_integration_path(project, :github)
expect(page).to have_gitlab_http_status(:not_found)
......@@ -33,7 +33,7 @@ RSpec.describe 'User activates GitHub Service' do
fill_in "Repository URL", with: 'https://github.com/h5bp/html5-boilerplate'
end
it 'activates service' do
it 'activates integration' do
click_button('Save')
expect(page).to have_content('GitHub settings saved and active.')
......@@ -47,7 +47,7 @@ RSpec.describe 'User activates GitHub Service' do
let(:pipeline) { create(:ci_pipeline) }
let(:project) { create(:project, ci_pipelines: [pipeline])}
it 'tests service before save' do
it 'tests integration before save' do
stub_request(:post, "https://api.github.com/repos/h5bp/html5-boilerplate/statuses/#{pipeline.sha}").to_return(
body: { context: {} }.to_json,
headers: { 'Content-Type' => 'application/json' }
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
RSpec.describe 'User activates Jira', :js do
include_context 'project service activation'
include_context 'project service Jira context'
include_context 'project integration activation'
include_context 'project integration Jira context'
describe 'user sets and activates Jira Service' do
describe 'user sets and activates Jira integration' do
before do
server_info = { key: 'value' }.to_json
stub_request(:get, test_url).with(basic_auth: %w(username password)).to_return(body: server_info)
......
......@@ -3,16 +3,16 @@
require 'spec_helper'
RSpec.describe 'Disable individual triggers', :js do
include_context 'project service activation'
include_context 'project integration activation'
let(:checkbox_selector) { 'input[name$="_events]"]' }
before do
visit_project_integration(service_name)
visit_project_integration(integration_name)
end
context 'service has multiple supported events' do
let(:service_name) { 'Jenkins' }
context 'integration has multiple supported events' do
let(:integration_name) { 'Jenkins' }
it 'shows trigger checkboxes' do
event_count = Integrations::Jenkins.supported_events.count
......@@ -22,8 +22,8 @@ RSpec.describe 'Disable individual triggers', :js do
end
end
context 'services only has one supported event' do
let(:service_name) { 'Asana' }
context 'integrations only has one supported event' do
let(:integration_name) { 'Asana' }
it "doesn't show unnecessary Trigger checkboxes" do
expect(page).not_to have_content "Trigger"
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Integrations settings form', :js do
include IntegrationsHelper
include_context 'project service activation'
include_context 'project integration activation'
# Github integration is EE, so let's remove it here.
integration_names = Integration.available_integration_names - %w[github]
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'Prometheus external alerts', :js do
include_context 'project service activation'
include_context 'project integration activation'
let(:alerts_section_selector) { '.js-prometheus-alerts' }
let(:alerts_section) { page.find(alerts_section_selector) }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
RSpec.describe 'User activates Asana' do
include_context 'project service activation'
include_context 'project integration activation'
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('Asana')
fill_in('API key', with: 'verySecret')
fill_in('Restrict to branch', with: 'verySecret')
......
......@@ -3,13 +3,13 @@
require 'spec_helper'
RSpec.describe 'User activates Assembla' do
include_context 'project service activation'
include_context 'project integration activation'
before do
stub_request(:post, /.*atlas.assembla.com.*/)
end
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('Assembla')
fill_in('Token', with: 'verySecret')
......
......@@ -3,13 +3,13 @@
require 'spec_helper'
RSpec.describe 'User activates Atlassian Bamboo CI' do
include_context 'project service activation'
include_context 'project integration activation'
before do
stub_request(:get, /.*bamboo.example.com.*/)
end
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('Atlassian Bamboo')
fill_in('Bamboo URL', with: 'http://bamboo.example.com')
fill_in('Build key', with: 'KEY')
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
RSpec.describe 'User activates Emails on push' do
include_context 'project service activation'
include_context 'project integration activation'
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('Emails on push')
fill_in('Recipients', with: 'qa@company.name')
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'User activates Flowdock' do
include_context 'project service activation' do
include_context 'project integration activation' do
let(:project) { create(:project, :repository) }
end
......@@ -11,7 +11,7 @@ RSpec.describe 'User activates Flowdock' do
stub_request(:post, /.*api.flowdock.com.*/)
end
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('Flowdock')
fill_in('Token', with: 'verySecret')
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
RSpec.describe 'User activates irker (IRC gateway)' do
include_context 'project service activation'
include_context 'project integration activation'
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('irker (IRC gateway)')
check('Colorize messages')
fill_in('Recipients', with: 'irc://chat.freenode.net/#commits')
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'User activates issue tracker', :js do
include_context 'project service activation'
include_context 'project integration activation'
let(:url) { 'http://tracker.example.com' }
......@@ -17,7 +17,7 @@ RSpec.describe 'User activates issue tracker', :js do
end
shared_examples 'external issue tracker activation' do |tracker:, skip_new_issue_url: false, skip_test: false|
describe 'user sets and activates the Service' do
describe 'user sets and activates the integration' do
context 'when the connection test succeeds' do
before do
stub_request(:head, url).to_return(headers: { 'Content-Type' => 'application/json' })
......@@ -32,7 +32,7 @@ RSpec.describe 'User activates issue tracker', :js do
end
end
it 'activates the service' do
it 'activates the integration' do
expect(page).to have_content("#{tracker} settings saved and active.")
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_')))
end
......@@ -45,7 +45,7 @@ RSpec.describe 'User activates issue tracker', :js do
end
context 'when the connection test fails' do
it 'activates the service' do
it 'activates the integration' do
stub_request(:head, url).to_raise(Gitlab::HTTP::Error)
visit_project_integration(tracker)
......@@ -63,7 +63,7 @@ RSpec.describe 'User activates issue tracker', :js do
end
end
describe 'user disables the service' do
describe 'user disables the integration' do
before do
visit_project_integration(tracker)
fill_form(disable: true, skip_new_issue_url: skip_new_issue_url)
......@@ -71,7 +71,7 @@ RSpec.describe 'User activates issue tracker', :js do
click_button('Save changes')
end
it 'saves but does not activate the service' do
it 'saves but does not activate the integration' do
expect(page).to have_content("#{tracker} settings saved, but not active.")
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_')))
end
......
......@@ -3,13 +3,13 @@
require 'spec_helper'
RSpec.describe 'User activates JetBrains TeamCity CI' do
include_context 'project service activation'
include_context 'project integration activation'
before do
stub_request(:post, /.*teamcity.example.com.*/)
end
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('JetBrains TeamCity')
check('Push')
check('Merge Request')
......
......@@ -3,14 +3,14 @@
require 'spec_helper'
RSpec.describe 'User activates Jira', :js do
include_context 'project service activation'
include_context 'project service Jira context'
include_context 'project integration activation'
include_context 'project integration Jira context'
before do
stub_request(:get, test_url).to_return(body: { key: 'value' }.to_json)
end
describe 'user tests Jira Service' do
describe 'user tests Jira integration' do
context 'when Jira connection test succeeds' do
before do
visit_project_integration('Jira')
......@@ -18,7 +18,7 @@ RSpec.describe 'User activates Jira', :js do
click_test_then_save_integration(expect_test_to_fail: false)
end
it 'activates the Jira service' do
it 'activates the Jira integration' do
expect(page).to have_content('Jira settings saved and active.')
expect(current_path).to eq(edit_project_integration_path(project, :jira))
end
......@@ -46,7 +46,7 @@ RSpec.describe 'User activates Jira', :js do
end
end
it 'activates the Jira service' do
it 'activates the Jira integration' do
stub_request(:get, test_url).with(basic_auth: %w(username password))
.to_raise(JIRA::HTTPError.new(double(message: 'message')))
......@@ -60,7 +60,7 @@ RSpec.describe 'User activates Jira', :js do
end
end
describe 'user disables the Jira Service' do
describe 'user disables the Jira integration' do
include JiraServiceHelper
before do
......@@ -70,7 +70,7 @@ RSpec.describe 'User activates Jira', :js do
click_save_integration
end
it 'saves but does not activate the Jira service' do
it 'saves but does not activate the Jira integration' do
expect(page).to have_content('Jira settings saved, but not active.')
expect(current_path).to eq(edit_project_integration_path(project, :jira))
end
......
......@@ -4,14 +4,14 @@ require 'spec_helper'
RSpec.describe 'Set up Mattermost slash commands', :js do
describe 'user visits the mattermost slash command config page' do
include_context 'project service activation'
include_context 'project integration activation'
before do
stub_mattermost_setting(enabled: mattermost_enabled)
visit_project_integration('Mattermost slash commands')
end
context 'mattermost service is enabled' do
context 'mattermost integration is enabled' do
let(:mattermost_enabled) { true }
describe 'activation' do
......@@ -84,7 +84,9 @@ RSpec.describe 'Set up Mattermost slash commands', :js do
end
it 'shows an error alert with the error message if there is an error requesting teams' do
allow_any_instance_of(Integrations::MattermostSlashCommands).to receive(:list_teams) { [[], 'test mattermost error message'] }
allow_next_instance_of(Integrations::MattermostSlashCommands) do |integration|
allow(integration).to receive(:list_teams).and_return([[], 'test mattermost error message'])
end
click_link 'Add to Mattermost'
......@@ -113,7 +115,9 @@ RSpec.describe 'Set up Mattermost slash commands', :js do
def stub_teams(count: 0)
teams = create_teams(count)
allow_any_instance_of(Integrations::MattermostSlashCommands).to receive(:list_teams) { [teams, nil] }
allow_next_instance_of(Integrations::MattermostSlashCommands) do |integration|
allow(integration).to receive(:list_teams).and_return([teams, nil])
end
teams
end
......@@ -129,7 +133,7 @@ RSpec.describe 'Set up Mattermost slash commands', :js do
end
end
context 'mattermost service is not enabled' do
context 'mattermost integration is not enabled' do
let(:mattermost_enabled) { false }
it 'shows the correct trigger url' do
......
......@@ -3,13 +3,13 @@
require 'spec_helper'
RSpec.describe 'User activates Packagist' do
include_context 'project service activation'
include_context 'project integration activation'
before do
stub_request(:post, /.*packagist.org.*/)
end
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('Packagist')
fill_in('Username', with: 'theUser')
fill_in('Token', with: 'verySecret')
......
......@@ -3,13 +3,13 @@
require 'spec_helper'
RSpec.describe 'User activates PivotalTracker' do
include_context 'project service activation'
include_context 'project integration activation'
before do
stub_request(:post, /.*www.pivotaltracker.com.*/)
end
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('Pivotal Tracker')
fill_in('Token', with: 'verySecret')
......
......@@ -3,13 +3,13 @@
require 'spec_helper'
RSpec.describe 'User activates Prometheus' do
include_context 'project service activation'
include_context 'project integration activation'
before do
stub_request(:get, /.*prometheus.example.com.*/)
end
it 'does not activate service and informs about deprecation', :js do
it 'does not activate integration and informs about deprecation', :js do
visit_project_integration('Prometheus')
check('Active')
fill_in('API URL', with: 'http://prometheus.example.com')
......
......@@ -3,13 +3,13 @@
require 'spec_helper'
RSpec.describe 'User activates Pushover' do
include_context 'project service activation'
include_context 'project integration activation'
before do
stub_request(:post, /.*api.pushover.net.*/)
end
it 'activates service', :js do
it 'activates integration', :js do
visit_project_integration('Pushover')
fill_in('API key', with: 'verySecret')
fill_in('User key', with: 'verySecret')
......
......@@ -3,14 +3,14 @@
require 'spec_helper'
RSpec.describe 'User activates Slack notifications', :js do
include_context 'project service activation'
include_context 'project integration activation'
context 'when service is not configured yet' do
context 'when integration is not configured yet' do
before do
visit_project_integration('Slack notifications')
end
it 'activates service' do
it 'activates integration' do
fill_in('Webhook', with: 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685')
click_test_then_save_integration
......@@ -19,7 +19,7 @@ RSpec.describe 'User activates Slack notifications', :js do
end
end
context 'when service is already configured' do
context 'when integration is already configured' do
let(:integration) { Integrations::Slack.new }
let(:project) { create(:project, slack_integration: integration) }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'Slack slash commands', :js do
include_context 'project service activation'
include_context 'project integration activation'
before do
visit_project_integration('Slack slash commands')
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'User uses inherited settings', :js do
include JiraServiceHelper
include_context 'project service activation'
include_context 'project integration activation'
before do
stub_jira_integration_test
......
......@@ -2,10 +2,10 @@
require 'spec_helper'
RSpec.describe 'User views services', :js do
include_context 'project service activation'
RSpec.describe 'User views integrations', :js do
include_context 'project integration activation'
it 'shows the list of available services' do
it 'shows the list of available integrations' do
visit_project_integrations
expect(page).to have_content('Integrations')
......
# frozen_string_literal: true
RSpec.shared_context 'project service Jira context' do
RSpec.shared_context 'project integration Jira context' do
let(:url) { 'https://jira.example.com' }
let(:test_url) { 'https://jira.example.com/rest/api/2/serverInfo' }
......
# frozen_string_literal: true
RSpec.shared_context 'project service activation' do
RSpec.shared_context 'project integration activation' do
include_context 'integration activation'
let_it_be(:project) { create(:project) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment