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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
eed0b3b5
Commit
eed0b3b5
authored
Oct 21, 2014
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '7-4-stable' into ee_stable
parents
91402ac0
536f61e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
app/models/project_services/slack_service.rb
app/models/project_services/slack_service.rb
+2
-1
spec/models/slack_service_spec.rb
spec/models/slack_service_spec.rb
+20
-0
No files found.
app/models/project_services/slack_service.rb
View file @
eed0b3b5
...
...
@@ -40,7 +40,8 @@ class SlackService < Service
project_name:
project_name
))
credentials
=
webhook
.
match
(
/(\w*).slack.com.*services\/(.*)/
)
credentials
=
webhook
.
match
(
/([\w-]*).slack.com.*services\/(.*)/
)
if
credentials
.
present?
subdomain
=
credentials
[
1
]
token
=
credentials
[
2
].
split
(
"token="
).
last
...
...
spec/models/slack_service_spec.rb
View file @
eed0b3b5
...
...
@@ -77,5 +77,25 @@ describe SlackService do
WebMock
.
should
have_requested
(
:post
,
api_url
).
once
end
end
context
'with new webhook syntax with slack allowed team name'
do
before
do
@allowed_webhook
=
'https://gitlab-hq-123.slack.com/services/hooks/incoming-webhook?token=cdIj4r4LfXUOySDUjp0tk3OI'
slack_service
.
stub
(
project:
project
,
project_id:
project
.
id
,
service_hook:
true
,
webhook:
@allowed_webhook
)
WebMock
.
stub_request
(
:post
,
@allowed_webhook
)
end
it
"should call Slack API"
do
slack_service
.
execute
(
sample_data
)
WebMock
.
should
have_requested
(
:post
,
@allowed_webhook
).
once
end
end
end
end
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