2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'User activates Slack notifications', :js do
|
2020-04-22 19:07:51 +05:30
|
|
|
include_context 'project service activation'
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
context 'when service is not configured yet' do
|
|
|
|
before do
|
2020-04-22 19:07:51 +05:30
|
|
|
visit_project_integration('Slack notifications')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
it 'activates service' do
|
2018-03-17 18:26:18 +05:30
|
|
|
fill_in('Webhook', with: 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685')
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
click_test_then_save_integration
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
expect(page).to have_content('Slack notifications settings saved and active.')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when service is already configured' do
|
2020-04-22 19:07:51 +05:30
|
|
|
let(:service) { SlackService.new }
|
|
|
|
let(:project) { create(:project, slack_service: service) }
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
before do
|
|
|
|
service.fields
|
2018-11-18 11:00:15 +05:30
|
|
|
service.update(
|
2018-03-17 18:26:18 +05:30
|
|
|
push_channel: 1,
|
|
|
|
issue_channel: 2,
|
|
|
|
merge_request_channel: 3,
|
|
|
|
note_channel: 4,
|
|
|
|
tag_push_channel: 5,
|
|
|
|
pipeline_channel: 6,
|
|
|
|
wiki_page_channel: 7)
|
|
|
|
|
|
|
|
visit(edit_project_service_path(project, service))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters events by channel' do
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(page.find_field(name: 'service[push_channel]').value).to have_content('1')
|
|
|
|
expect(page.find_field(name: 'service[issue_channel]').value).to have_content('2')
|
|
|
|
expect(page.find_field(name: 'service[merge_request_channel]').value).to have_content('3')
|
|
|
|
expect(page.find_field(name: 'service[note_channel]').value).to have_content('4')
|
|
|
|
expect(page.find_field(name: 'service[tag_push_channel]').value).to have_content('5')
|
|
|
|
expect(page.find_field(name: 'service[pipeline_channel]').value).to have_content('6')
|
|
|
|
expect(page.find_field(name: 'service[wiki_page_channel]').value).to have_content('7')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|