gitlab-org--gitlab-foss/spec/features/projects/services/slack_slash_command_spec.rb

41 lines
1.1 KiB
Ruby
Raw Normal View History

require 'spec_helper'
2016-12-19 09:40:06 -05:00
feature 'Slack slash commands', feature: true do
include WaitForAjax
2016-12-19 09:40:06 -05:00
given(:user) { create(:user) }
given(:project) { create(:project) }
given(:service) { project.create_slack_slash_commands_service }
2016-12-19 09:40:06 -05:00
background do
project.team << [user, :master]
login_as(user)
end
2016-12-19 16:12:30 -05:00
scenario 'user visits the slack slash command config page and shows a help message', js: true do
visit edit_namespace_project_service_path(project.namespace, project, service)
2016-12-19 16:12:30 -05:00
wait_for_ajax
2016-12-19 16:12:30 -05:00
expect(page).to have_content('This service allows GitLab users to perform common')
end
2016-12-19 16:12:30 -05:00
scenario 'shows the token after saving' do
visit edit_namespace_project_service_path(project.namespace, project, service)
2016-12-19 16:12:30 -05:00
fill_in 'service_token', with: 'token'
click_on 'Save'
2016-12-19 16:12:30 -05:00
value = find_field('service_token').value
2016-12-19 16:12:30 -05:00
expect(value).to eq('token')
end
2016-12-19 16:12:30 -05:00
scenario 'shows the correct trigger url' do
visit edit_namespace_project_service_path(project.namespace, project, service)
2016-12-19 16:12:30 -05:00
value = find_field('url').value
expect(value).to match("api/v3/projects/#{project.id}/services/slack_slash_commands/trigger")
end
end