diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2016-12-20 09:41:37 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2016-12-20 09:41:37 +0000 |
commit | 52278412c7350b8087ef4ffc688c79e4593369cc (patch) | |
tree | 8f6769b3563db7c5d8ebaf01e2b1e939579913e6 /spec/features | |
parent | 7572a31430cd4dbd6ed8d3da5f06010858d7c487 (diff) | |
parent | e06f88effa842c73d3827593f8d28846207bfca0 (diff) | |
download | gitlab-ce-52278412c7350b8087ef4ffc688c79e4593369cc.tar.gz |
Merge branch 'zj-kamil-slack-slash-commands' into 'master'
Slack slash commands
## What does this MR do?
Implement Slack Slash Commands by utilizing generalized Mattermost presenter to fulfill Slack requirements.
## Why was this MR needed?
We want to expose Slack Slash Commands as a first-class service.
## What are the relevant issue numbers?
Supersedes !8007
Closes #22182
See merge request !8126
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/projects/services/slack_slash_command_spec.rb | 40 |
2 files changed, 43 insertions, 3 deletions
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 8cd66f189be..47fa2f14307 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -17,9 +17,9 @@ feature 'Admin updates settings', feature: true do expect(page).to have_content "Application settings saved successfully" end - scenario 'Change Slack Service template settings' do + scenario 'Change Slack Notifications Service template settings' do click_link 'Service Templates' - click_link 'Slack' + click_link 'Slack notifications' fill_in 'Webhook', with: 'http://localhost' fill_in 'Username', with: 'test_user' fill_in 'service_push_channel', with: '#test_channel' @@ -30,7 +30,7 @@ feature 'Admin updates settings', feature: true do expect(page).to have_content 'Application settings saved successfully' - click_link 'Slack' + click_link 'Slack notifications' page.all('input[type=checkbox]').each do |checkbox| expect(checkbox).to be_checked diff --git a/spec/features/projects/services/slack_slash_command_spec.rb b/spec/features/projects/services/slack_slash_command_spec.rb new file mode 100644 index 00000000000..32b32f7ae8e --- /dev/null +++ b/spec/features/projects/services/slack_slash_command_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +feature 'Slack slash commands', feature: true do + include WaitForAjax + + given(:user) { create(:user) } + given(:project) { create(:project) } + given(:service) { project.create_slack_slash_commands_service } + + background do + project.team << [user, :master] + login_as(user) + end + + 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) + + wait_for_ajax + + expect(page).to have_content('This service allows GitLab users to perform common') + end + + scenario 'shows the token after saving' do + visit edit_namespace_project_service_path(project.namespace, project, service) + + fill_in 'service_token', with: 'token' + click_on 'Save' + + value = find_field('service_token').value + + expect(value).to eq('token') + end + + scenario 'shows the correct trigger url' do + visit edit_namespace_project_service_path(project.namespace, project, service) + + value = find_field('url').value + expect(value).to match("api/v3/projects/#{project.id}/services/slack_slash_commands/trigger") + end +end |