Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/services')
-rw-r--r--spec/features/projects/services/disable_triggers_spec.rb2
-rw-r--r--spec/features/projects/services/user_activates_flowdock_spec.rb22
-rw-r--r--spec/features/projects/services/user_activates_jira_spec.rb149
-rw-r--r--spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb35
-rw-r--r--spec/features/projects/services/user_activates_pivotaltracker_spec.rb20
-rw-r--r--spec/features/projects/services/user_activates_slack_notifications_spec.rb2
6 files changed, 7 insertions, 223 deletions
diff --git a/spec/features/projects/services/disable_triggers_spec.rb b/spec/features/projects/services/disable_triggers_spec.rb
index d9e200cf563..c6413685f38 100644
--- a/spec/features/projects/services/disable_triggers_spec.rb
+++ b/spec/features/projects/services/disable_triggers_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe 'Disable individual triggers', :js do
let(:service_name) { 'Jenkins' }
it 'shows trigger checkboxes' do
- event_count = JenkinsService.supported_events.count
+ event_count = Integrations::Jenkins.supported_events.count
expect(page).to have_content "Trigger"
expect(page).to have_css(checkbox_selector, visible: :all, count: event_count)
diff --git a/spec/features/projects/services/user_activates_flowdock_spec.rb b/spec/features/projects/services/user_activates_flowdock_spec.rb
deleted file mode 100644
index 4a4d7bbecfd..00000000000
--- a/spec/features/projects/services/user_activates_flowdock_spec.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'User activates Flowdock' do
- include_context 'project service activation' do
- let(:project) { create(:project, :repository) }
- end
-
- before do
- stub_request(:post, /.*api.flowdock.com.*/)
- end
-
- it 'activates service', :js do
- visit_project_integration('Flowdock')
- fill_in('Token', with: 'verySecret')
-
- click_test_then_save_integration(expect_test_to_fail: false)
-
- expect(page).to have_content('Flowdock settings saved and active.')
- end
-end
diff --git a/spec/features/projects/services/user_activates_jira_spec.rb b/spec/features/projects/services/user_activates_jira_spec.rb
deleted file mode 100644
index 10f84aae93f..00000000000
--- a/spec/features/projects/services/user_activates_jira_spec.rb
+++ /dev/null
@@ -1,149 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'User activates Jira', :js do
- include_context 'project service activation'
- include_context 'project service Jira context'
-
- before do
- stub_request(:get, test_url).to_return(body: { key: 'value' }.to_json)
- end
-
- describe 'user tests Jira Service' do
- context 'when Jira connection test succeeds' do
- before do
- visit_project_integration('Jira')
- fill_form
- click_test_then_save_integration(expect_test_to_fail: false)
- end
-
- it 'activates the Jira service' do
- expect(page).to have_content('Jira settings saved and active.')
- expect(current_path).to eq(edit_project_service_path(project, :jira))
- end
-
- unless Gitlab.ee?
- it 'adds Jira link to sidebar menu' do
- page.within('.nav-sidebar') do
- expect(page).not_to have_link('Jira Issues')
- expect(page).not_to have_link('Issue List', visible: false)
- expect(page).not_to have_link('Open Jira', href: url, visible: false)
- expect(page).to have_link('Jira', href: url)
- end
- end
- end
- end
-
- context 'when Jira connection test fails' do
- it 'shows errors when some required fields are not filled in' do
- visit_project_integration('Jira')
-
- fill_in 'service_password', with: 'password'
- click_test_integration
-
- page.within('.service-settings') do
- expect(page).to have_content('This field is required.')
- end
- end
-
- it 'activates the Jira service' do
- stub_request(:get, test_url).with(basic_auth: %w(username password))
- .to_raise(JIRA::HTTPError.new(double(message: 'message')))
-
- visit_project_integration('Jira')
- fill_form
- click_test_then_save_integration
-
- expect(page).to have_content('Jira settings saved and active.')
- expect(current_path).to eq(edit_project_service_path(project, :jira))
- end
- end
- end
-
- describe 'user disables the Jira Service' do
- include JiraServiceHelper
-
- before do
- stub_jira_service_test
- visit_project_integration('Jira')
- fill_form(disable: true)
- click_save_integration
- end
-
- it 'saves but does not activate the Jira service' do
- expect(page).to have_content('Jira settings saved, but not active.')
- expect(current_path).to eq(edit_project_service_path(project, :jira))
- end
-
- it 'does not show the Jira link in the menu' do
- page.within('.nav-sidebar') do
- expect(page).not_to have_link('Jira', href: url)
- end
- end
- end
-
- describe 'issue transition settings' do
- it 'using custom transitions' do
- visit_project_integration('Jira')
-
- expect(page).to have_field('Enable Jira transitions', checked: false)
-
- check 'Enable Jira transitions'
-
- expect(page).to have_field('Move to Done', checked: true)
-
- fill_form
- choose 'Use custom transitions'
- click_save_integration
-
- within '[data-testid="issue-transition-mode"]' do
- expect(page).to have_content('This field is required.')
- end
-
- fill_in 'service[jira_issue_transition_id]', with: '1, 2, 3'
- click_save_integration
-
- expect(page).to have_content('Jira settings saved and active.')
- expect(project.reload.jira_service.data_fields).to have_attributes(
- jira_issue_transition_automatic: false,
- jira_issue_transition_id: '1, 2, 3'
- )
- end
-
- it 'using automatic transitions' do
- create(:jira_service, project: project, jira_issue_transition_automatic: false, jira_issue_transition_id: '1, 2, 3')
- visit_project_integration('Jira')
-
- expect(page).to have_field('Enable Jira transitions', checked: true)
- expect(page).to have_field('Use custom transitions', checked: true)
- expect(page).to have_field('service[jira_issue_transition_id]', with: '1, 2, 3')
-
- choose 'Move to Done'
- click_save_integration
-
- expect(page).to have_content('Jira settings saved and active.')
- expect(project.reload.jira_service.data_fields).to have_attributes(
- jira_issue_transition_automatic: true,
- jira_issue_transition_id: ''
- )
- end
-
- it 'disabling issue transitions' do
- create(:jira_service, project: project, jira_issue_transition_automatic: true, jira_issue_transition_id: '1, 2, 3')
- visit_project_integration('Jira')
-
- expect(page).to have_field('Enable Jira transitions', checked: true)
- expect(page).to have_field('Move to Done', checked: true)
-
- uncheck 'Enable Jira transitions'
- click_save_integration
-
- expect(page).to have_content('Jira settings saved and active.')
- expect(project.reload.jira_service.data_fields).to have_attributes(
- jira_issue_transition_automatic: false,
- jira_issue_transition_id: ''
- )
- end
- end
-end
diff --git a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb
index 54a501e89a2..b2ca0424b6d 100644
--- a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb
+++ b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb
@@ -14,35 +14,10 @@ RSpec.describe 'Set up Mattermost slash commands', :js do
context 'mattermost service is enabled' do
let(:mattermost_enabled) { true }
- it 'shows a help message' do
- expect(page).to have_content("Use this service to perform common")
- end
-
- it 'shows a token placeholder' do
- token_placeholder = find_field('service_token')['placeholder']
-
- expect(token_placeholder).to eq('XXxxXXxxXXxxXXxxXXxxXXxx')
- end
-
- it 'redirects to the integrations page after saving but not activating' do
- token = ('a'..'z').to_a.join
-
- fill_in 'service_token', with: token
- click_active_checkbox
- click_save_integration
-
- expect(current_path).to eq(edit_project_service_path(project, :mattermost_slash_commands))
- expect(page).to have_content('Mattermost slash commands settings saved, but not active.')
- end
-
- it 'redirects to the integrations page after activating' do
- token = ('a'..'z').to_a.join
-
- fill_in 'service_token', with: token
- click_save_integration
+ describe 'activation' do
+ let(:edit_path) { edit_project_service_path(project, :mattermost_slash_commands) }
- expect(current_path).to eq(edit_project_service_path(project, :mattermost_slash_commands))
- expect(page).to have_content('Mattermost slash commands settings saved and active.')
+ include_examples 'user activates the Mattermost Slash Command integration'
end
it 'shows the add to mattermost button' do
@@ -109,7 +84,7 @@ 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(MattermostSlashCommandsService).to receive(:list_teams) { [[], 'test mattermost error message'] }
+ allow_any_instance_of(Integrations::MattermostSlashCommands).to receive(:list_teams) { [[], 'test mattermost error message'] }
click_link 'Add to Mattermost'
@@ -138,7 +113,7 @@ RSpec.describe 'Set up Mattermost slash commands', :js do
def stub_teams(count: 0)
teams = create_teams(count)
- allow_any_instance_of(MattermostSlashCommandsService).to receive(:list_teams) { [teams, nil] }
+ allow_any_instance_of(Integrations::MattermostSlashCommands).to receive(:list_teams) { [teams, nil] }
teams
end
diff --git a/spec/features/projects/services/user_activates_pivotaltracker_spec.rb b/spec/features/projects/services/user_activates_pivotaltracker_spec.rb
deleted file mode 100644
index 83f66d4fa7b..00000000000
--- a/spec/features/projects/services/user_activates_pivotaltracker_spec.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'User activates PivotalTracker' do
- include_context 'project service activation'
-
- before do
- stub_request(:post, /.*www.pivotaltracker.com.*/)
- end
-
- it 'activates service', :js do
- visit_project_integration('PivotalTracker')
- fill_in('Token', with: 'verySecret')
-
- click_test_then_save_integration(expect_test_to_fail: false)
-
- expect(page).to have_content('PivotalTracker settings saved and active.')
- end
-end
diff --git a/spec/features/projects/services/user_activates_slack_notifications_spec.rb b/spec/features/projects/services/user_activates_slack_notifications_spec.rb
index 0cba1ee1c4c..dec83ff1489 100644
--- a/spec/features/projects/services/user_activates_slack_notifications_spec.rb
+++ b/spec/features/projects/services/user_activates_slack_notifications_spec.rb
@@ -20,7 +20,7 @@ RSpec.describe 'User activates Slack notifications', :js do
end
context 'when service is already configured' do
- let(:service) { SlackService.new }
+ let(:service) { Integrations::Slack.new }
let(:project) { create(:project, slack_service: service) }
before do