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
8720f46a
Commit
8720f46a
authored
Dec 06, 2021
by
Sven Groot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for deployment events
parent
afb84289
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb
...integrations/slack_mattermost_notifier_shared_examples.rb
+50
-0
No files found.
spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb
View file @
8720f46a
...
...
@@ -645,4 +645,54 @@ RSpec.shared_examples Integrations::SlackMattermostNotifier do |service_name|
end
end
end
describe
'Deployment events'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be_with_reload
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let
(
:deployment
)
do
create
(
:deployment
,
:success
,
project:
project
,
sha:
project
.
commit
.
sha
,
ref:
project
.
default_branch
)
end
let
(
:data
)
{
Gitlab
::
DataBuilder
::
Deployment
.
build
(
deployment
,
Time
.
now
)
}
before
do
allow
(
chat_service
).
to
receive_messages
(
project:
project
,
service_hook:
true
,
webhook:
webhook_url
)
stub_full_request
(
webhook_url
,
method: :post
)
end
it_behaves_like
"triggered
#{
service_name
}
service"
,
event_type:
"deployment"
context
'on a protected branch'
do
before
do
create
(
:protected_branch
,
project:
project
,
name:
'a-protected-branch'
)
project
.
repository
.
create_branch
(
'a-protected-branch'
,
project
.
default_branch_or_main
)
end
let
(
:deployment
)
do
create
(
:deployment
,
:success
,
project:
project
,
sha:
project
.
commit
.
sha
,
ref:
'a-protected-branch'
)
end
context
'notification enabled only for default branch'
do
it_behaves_like
"untriggered
#{
service_name
}
service"
,
event_type:
"pipeline"
,
branches_to_be_notified:
"default"
end
context
'notification enabled only for protected branches'
do
it_behaves_like
"triggered
#{
service_name
}
service"
,
event_type:
"pipeline"
,
branches_to_be_notified:
"protected"
end
context
'notification enabled only for default and protected branches'
do
it_behaves_like
"triggered
#{
service_name
}
service"
,
event_type:
"pipeline"
,
branches_to_be_notified:
"default_and_protected"
end
context
'notification enabled for all branches'
do
it_behaves_like
"triggered
#{
service_name
}
service"
,
event_type:
"pipeline"
,
branches_to_be_notified:
"all"
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