debian-mirror-gitlab/spec/features/projects/services/user_activates_slack_slash_command_spec.rb

46 lines
1.4 KiB
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
2018-11-08 19:23:39 +05:30
describe 'Slack slash commands' do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:service) { project.create_slack_slash_commands_service }
2017-08-17 22:00:37 +05:30
2018-11-08 19:23:39 +05:30
before do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2017-09-10 17:25:29 +05:30
sign_in(user)
visit edit_project_service_path(project, service)
2017-08-17 22:00:37 +05:30
end
it 'shows a token placeholder' do
token_placeholder = find_field('service_token')['placeholder']
expect(token_placeholder).to eq('XXxxXXxxXXxxXXxxXXxxXXxx')
end
it 'shows a help message' do
expect(page).to have_content('This service allows users to perform common')
end
2017-09-10 17:25:29 +05:30
it 'redirects to the integrations page after saving but not activating' do
2017-08-17 22:00:37 +05:30
fill_in 'service_token', with: 'token'
click_on 'Save'
2017-09-10 17:25:29 +05:30
expect(current_path).to eq(project_settings_integrations_path(project))
expect(page).to have_content('Slack slash commands settings saved, but not activated.')
end
it 'redirects to the integrations page after activating' do
fill_in 'service_token', with: 'token'
check 'service_active'
click_on 'Save'
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
expect(current_path).to eq(project_settings_integrations_path(project))
expect(page).to have_content('Slack slash commands activated.')
2017-08-17 22:00:37 +05:30
end
it 'shows the correct trigger url' do
value = find_field('url').value
2017-09-10 17:25:29 +05:30
expect(value).to match("api/v4/projects/#{project.id}/services/slack_slash_commands/trigger")
2017-08-17 22:00:37 +05:30
end
end