Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
298d05a5
Commit
298d05a5
authored
Dec 19, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve after feedback
parent
b1ccf99e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
32 additions
and
51 deletions
+32
-51
features/project/service.feature
features/project/service.feature
+3
-3
features/steps/project/services.rb
features/steps/project/services.rb
+4
-4
lib/api/services.rb
lib/api/services.rb
+8
-1
lib/gitlab/chat_commands/help.rb
lib/gitlab/chat_commands/help.rb
+0
-28
lib/gitlab/chat_commands/presenter.rb
lib/gitlab/chat_commands/presenter.rb
+1
-1
spec/features/projects/services/slack_slash_command_spec.rb
spec/features/projects/services/slack_slash_command_spec.rb
+9
-9
spec/models/project_services/mattermost_slash_commands_service_spec.rb
...roject_services/mattermost_slash_commands_service_spec.rb
+2
-2
spec/models/project_services/slack_slash_commands_service.rb
spec/models/project_services/slack_slash_commands_service.rb
+4
-2
spec/support/chat_slash_commands_shared_examples.rb
spec/support/chat_slash_commands_shared_examples.rb
+1
-1
No files found.
features/project/service.feature
View file @
298d05a5
...
...
@@ -39,9 +39,9 @@ Feature: Project Services
Scenario
:
Activate Slack service
When
I visit project
"Shop"
services page
And
I click Slack service link
And
I fill Slack settings
Then
I should see Slack service settings saved
And
I click Slack
Notifications
service link
And
I fill Slack
Notifications
settings
Then
I should see Slack
Notifications
service settings saved
Scenario
:
Activate Pushover service
When
I visit project
"Shop"
services page
...
...
features/steps/project/services.rb
View file @
298d05a5
...
...
@@ -137,17 +137,17 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
expect
(
find_field
(
'Colorize messages'
).
value
).
to
eq
'1'
end
step
'I click Slack service link'
do
click_link
'Slack'
step
'I click Slack
Notifications
service link'
do
click_link
'Slack
Notifications
'
end
step
'I fill Slack settings'
do
step
'I fill Slack
Notifications
settings'
do
check
'Active'
fill_in
'Webhook'
,
with:
'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685'
click_button
'Save'
end
step
'I should see Slack service settings saved'
do
step
'I should see Slack
Notifications
service settings saved'
do
expect
(
find_field
(
'Webhook'
).
value
).
to
eq
'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685'
end
...
...
lib/api/services.rb
View file @
298d05a5
...
...
@@ -378,7 +378,6 @@ module API
desc:
'A custom certificate authority bundle to verify the Kubernetes cluster with (PEM format)'
},
],
'mattermost-slash-commands'
=>
[
{
required:
true
,
...
...
@@ -387,6 +386,14 @@ module API
desc:
'The Mattermost token'
}
],
'slack-slash-commands'
=>
[
{
required:
true
,
name: :token
,
type:
String
,
desc:
'The Slack token'
}
],
'pipelines-email'
=>
[
{
required:
true
,
...
...
lib/gitlab/chat_commands/help.rb
deleted
100644 → 0
View file @
b1ccf99e
module
Gitlab
module
ChatCommands
class
Help
<
BaseCommand
# This class has to be used last, as it always matches. It has to match
# because other commands were not triggered and we want to show the help
# command
def
self
.
match
(
_text
)
true
end
def
self
.
help_message
'help'
end
def
self
.
allowed?
(
_project
,
_user
)
true
end
def
execute
(
commands
)
Gitlab
::
ChatCommands
::
Presenters
::
Help
.
new
(
commands
).
present
(
trigger
)
end
def
trigger
params
[
:command
]
end
end
end
end
lib/gitlab/chat_commands/presenter.rb
View file @
298d05a5
module
Gitlab
module
ChatCommands
class
Presenter
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
def
authorize_chat_name
(
url
)
message
=
if
url
...
...
spec/features/projects/services/slack_slash_command_spec.rb
View file @
298d05a5
require
'spec_helper'
feature
'S
etup S
lack slash commands'
,
feature:
true
do
feature
'Slack slash commands'
,
feature:
true
do
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:service
)
{
project
.
create_slack_slash_commands_service
}
given
(
:user
)
{
create
(
:user
)
}
given
(
:project
)
{
create
(
:project
)
}
given
(
:service
)
{
project
.
create_slack_slash_commands_service
}
b
efore
do
b
ackground
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
end
describe
'user visits the slack slash command config page'
,
js:
true
do
scenario
'user visits the slack slash command config page'
,
js:
true
do
it
'shows a help message'
do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
...
...
@@ -22,8 +22,8 @@ feature 'Setup Slack slash commands', feature: true do
end
end
describe
'saving a token'
do
let
(
:token
)
{
(
'a'
..
'z'
).
to_a
.
join
}
scenario
'saving a token'
do
given
(
:token
)
{
(
'a'
..
'z'
).
to_a
.
join
}
it
'shows the token after saving'
do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
...
...
@@ -37,7 +37,7 @@ feature 'Setup Slack slash commands', feature: true do
end
end
describe
'the trigger url'
do
scenario
'the trigger url'
do
it
'shows the correct url'
do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
...
...
spec/models/project_services/mattermost_slash_commands_service_spec.rb
View file @
298d05a5
require
'spec_helper'
describe
MattermostSlashCommandsService
,
models:
true
do
it_behaves_like
"chat slash commands"
describe
MattermostSlashCommandsService
,
:models
do
it_behaves_like
"chat slash commands
service
"
end
spec/models/project_services/slack_slash_commands_service.rb
View file @
298d05a5
require
'spec_helper'
describe
SlackSlashCommandsService
,
models:
true
do
it_behaves_like
"chat slash commands"
describe
SlackSlashCommandsService
,
:models
do
it_behaves_like
"chat slash commands
service
"
describe
'#trigger'
do
context
'when an auth url is generated'
do
...
...
@@ -15,11 +15,13 @@ describe SlackSlashCommandsService, models: true do
token:
'token'
}
end
let
(
:service
)
do
project
.
create_slack_slash_commands_service
(
properties:
{
token:
'token'
}
)
end
let
(
:authorize_url
)
do
'http://authorize.example.com/'
end
...
...
spec/support/chat_slash_commands_shared_examples.rb
View file @
298d05a5
RSpec
.
shared_examples
'chat slash commands'
do
RSpec
.
shared_examples
'chat slash commands
service
'
do
describe
"Associations"
do
it
{
is_expected
.
to
respond_to
:token
}
it
{
is_expected
.
to
have_many
:chat_names
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment