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
aab584e1
Commit
aab584e1
authored
Nov 16, 2020
by
Andy Soiron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix kwargs warning in microsoft_teams notifier
parent
5ac5f7f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
lib/microsoft_teams/notifier.rb
lib/microsoft_teams/notifier.rb
+5
-6
spec/lib/microsoft_teams/notifier_spec.rb
spec/lib/microsoft_teams/notifier_spec.rb
+2
-2
No files found.
lib/microsoft_teams/notifier.rb
View file @
aab584e1
...
...
@@ -14,7 +14,7 @@ module MicrosoftTeams
response
=
Gitlab
::
HTTP
.
post
(
@webhook
.
to_str
,
headers:
@header
,
body:
body
(
options
)
body:
body
(
**
options
)
)
result
=
true
if
response
...
...
@@ -27,14 +27,13 @@ module MicrosoftTeams
private
def
body
(
options
=
{}
)
def
body
(
title:
nil
,
summary:
nil
,
attachments:
nil
,
activity
:
)
result
=
{
'sections'
=>
[]
}
result
[
'title'
]
=
options
[
:title
]
result
[
'summary'
]
=
options
[
:summary
]
result
[
'sections'
]
<<
MicrosoftTeams
::
Activity
.
new
(
options
[
:activity
]
).
prepare
result
[
'title'
]
=
title
result
[
'summary'
]
=
summary
result
[
'sections'
]
<<
MicrosoftTeams
::
Activity
.
new
(
**
activity
).
prepare
attachments
=
options
[
:attachments
]
unless
attachments
.
blank?
result
[
'sections'
]
<<
{
text:
attachments
}
end
...
...
spec/lib/microsoft_teams/notifier_spec.rb
View file @
aab584e1
...
...
@@ -51,11 +51,11 @@ RSpec.describe MicrosoftTeams::Notifier do
describe
'#body'
do
it
'returns Markdown-based body when HTML was passed'
do
expect
(
subject
.
send
(
:body
,
options
)).
to
eq
(
body
.
to_json
)
expect
(
subject
.
send
(
:body
,
**
options
)).
to
eq
(
body
.
to_json
)
end
it
'fails when empty Hash was passed'
do
expect
{
subject
.
send
(
:body
,
{})
}.
to
raise_error
(
ArgumentError
)
expect
{
subject
.
send
(
:body
,
**
{})
}.
to
raise_error
(
ArgumentError
)
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