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
74560c9e
Commit
74560c9e
authored
Jun 29, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove references to service in microsoft teams spec
parent
debc2cb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
spec/models/integrations/microsoft_teams_spec.rb
spec/models/integrations/microsoft_teams_spec.rb
+22
-22
No files found.
spec/models/integrations/microsoft_teams_spec.rb
View file @
74560c9e
...
...
@@ -3,7 +3,7 @@
require
'spec_helper'
RSpec
.
describe
Integrations
::
MicrosoftTeams
do
let
(
:chat_
service
)
{
described_class
.
new
}
let
(
:chat_
integration
)
{
described_class
.
new
}
let
(
:webhook_url
)
{
'https://example.gitlab.com/'
}
describe
"Associations"
do
...
...
@@ -12,16 +12,16 @@ RSpec.describe Integrations::MicrosoftTeams do
end
describe
'Validations'
do
context
'when
service
is active'
do
context
'when
integration
is active'
do
before
do
subject
.
active
=
true
end
it
{
is_expected
.
to
validate_presence_of
(
:webhook
)
}
it_behaves_like
'issue tracker
service
URL attribute'
,
:webhook
it_behaves_like
'issue tracker
integration
URL attribute'
,
:webhook
end
context
'when
service
is inactive'
do
context
'when
integration
is inactive'
do
before
do
subject
.
active
=
false
end
...
...
@@ -42,7 +42,7 @@ RSpec.describe Integrations::MicrosoftTeams do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:wiki_repo
)
}
before
do
allow
(
chat_
service
).
to
receive_messages
(
allow
(
chat_
integration
).
to
receive_messages
(
project:
project
,
project_id:
project
.
id
,
service_hook:
true
,
...
...
@@ -58,7 +58,7 @@ RSpec.describe Integrations::MicrosoftTeams do
end
it
"calls Microsoft Teams API for push events"
do
chat_
service
.
execute
(
push_sample_data
)
chat_
integration
.
execute
(
push_sample_data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
end
...
...
@@ -67,7 +67,7 @@ RSpec.describe Integrations::MicrosoftTeams do
integration
=
double
(
:microsoft_teams_integration
).
as_null_object
expect
(
::
MicrosoftTeams
::
Notifier
).
to
receive
(
:new
).
with
(
webhook_url
).
and_return
(
integration
)
chat_
service
.
execute
(
push_sample_data
)
chat_
integration
.
execute
(
push_sample_data
)
end
end
...
...
@@ -80,7 +80,7 @@ RSpec.describe Integrations::MicrosoftTeams do
end
it
"calls Microsoft Teams API"
do
chat_
service
.
execute
(
issues_sample_data
)
chat_
integration
.
execute
(
issues_sample_data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
end
...
...
@@ -107,7 +107,7 @@ RSpec.describe Integrations::MicrosoftTeams do
end
it
"calls Microsoft Teams API"
do
chat_
service
.
execute
(
merge_sample_data
)
chat_
integration
.
execute
(
merge_sample_data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
end
...
...
@@ -127,7 +127,7 @@ RSpec.describe Integrations::MicrosoftTeams do
let
(
:wiki_page_sample_data
)
{
Gitlab
::
DataBuilder
::
WikiPage
.
build
(
wiki_page
,
user
,
'create'
)
}
it
"calls Microsoft Teams API"
do
chat_
service
.
execute
(
wiki_page_sample_data
)
chat_
integration
.
execute
(
wiki_page_sample_data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
end
...
...
@@ -139,7 +139,7 @@ RSpec.describe Integrations::MicrosoftTeams do
let
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
before
do
allow
(
chat_
service
).
to
receive_messages
(
allow
(
chat_
integration
).
to
receive_messages
(
project:
project
,
project_id:
project
.
id
,
service_hook:
true
,
...
...
@@ -160,7 +160,7 @@ RSpec.describe Integrations::MicrosoftTeams do
it
"calls Microsoft Teams API for commit comment events"
do
data
=
Gitlab
::
DataBuilder
::
Note
.
build
(
commit_note
,
user
)
chat_
service
.
execute
(
data
)
chat_
integration
.
execute
(
data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
end
...
...
@@ -175,7 +175,7 @@ RSpec.describe Integrations::MicrosoftTeams do
it
"calls Microsoft Teams API for merge request comment events"
do
data
=
Gitlab
::
DataBuilder
::
Note
.
build
(
merge_request_note
,
user
)
chat_
service
.
execute
(
data
)
chat_
integration
.
execute
(
data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
end
...
...
@@ -189,7 +189,7 @@ RSpec.describe Integrations::MicrosoftTeams do
it
"calls Microsoft Teams API for issue comment events"
do
data
=
Gitlab
::
DataBuilder
::
Note
.
build
(
issue_note
,
user
)
chat_
service
.
execute
(
data
)
chat_
integration
.
execute
(
data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
end
...
...
@@ -204,7 +204,7 @@ RSpec.describe Integrations::MicrosoftTeams do
it
"calls Microsoft Teams API for snippet comment events"
do
data
=
Gitlab
::
DataBuilder
::
Note
.
build
(
snippet_note
,
user
)
chat_
service
.
execute
(
data
)
chat_
integration
.
execute
(
data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
end
...
...
@@ -222,7 +222,7 @@ RSpec.describe Integrations::MicrosoftTeams do
end
before
do
allow
(
chat_
service
).
to
receive_messages
(
allow
(
chat_
integration
).
to
receive_messages
(
project:
project
,
service_hook:
true
,
webhook:
webhook_url
...
...
@@ -232,14 +232,14 @@ RSpec.describe Integrations::MicrosoftTeams do
shared_examples
'call Microsoft Teams API'
do
|
branches_to_be_notified:
nil
|
before
do
WebMock
.
stub_request
(
:post
,
webhook_url
)
chat_
service
.
branches_to_be_notified
=
branches_to_be_notified
if
branches_to_be_notified
chat_
integration
.
branches_to_be_notified
=
branches_to_be_notified
if
branches_to_be_notified
end
it
'calls Microsoft Teams API for pipeline events'
do
data
=
Gitlab
::
DataBuilder
::
Pipeline
.
build
(
pipeline
)
data
[
:markdown
]
=
true
chat_
service
.
execute
(
data
)
chat_
integration
.
execute
(
data
)
message
=
Integrations
::
ChatMessage
::
PipelineMessage
.
new
(
data
)
...
...
@@ -251,11 +251,11 @@ RSpec.describe Integrations::MicrosoftTeams do
shared_examples
'does not call Microsoft Teams API'
do
|
branches_to_be_notified:
nil
|
before
do
chat_
service
.
branches_to_be_notified
=
branches_to_be_notified
if
branches_to_be_notified
chat_
integration
.
branches_to_be_notified
=
branches_to_be_notified
if
branches_to_be_notified
end
it
'does not call Microsoft Teams API for pipeline events'
do
data
=
Gitlab
::
DataBuilder
::
Pipeline
.
build
(
pipeline
)
result
=
chat_
service
.
execute
(
data
)
result
=
chat_
integration
.
execute
(
data
)
expect
(
result
).
to
be_falsy
end
...
...
@@ -273,7 +273,7 @@ RSpec.describe Integrations::MicrosoftTeams do
context
'with default to notify_only_broken_pipelines'
do
it
'does not call Microsoft Teams API for pipeline events'
do
data
=
Gitlab
::
DataBuilder
::
Pipeline
.
build
(
pipeline
)
result
=
chat_
service
.
execute
(
data
)
result
=
chat_
integration
.
execute
(
data
)
expect
(
result
).
to
be_falsy
end
...
...
@@ -281,7 +281,7 @@ RSpec.describe Integrations::MicrosoftTeams do
context
'with setting notify_only_broken_pipelines to false'
do
before
do
chat_
service
.
notify_only_broken_pipelines
=
false
chat_
integration
.
notify_only_broken_pipelines
=
false
end
it_behaves_like
'call Microsoft Teams API'
...
...
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