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
37e3b969
Commit
37e3b969
authored
Oct 08, 2019
by
Balasankar "Balu" C
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhance specs for notifications for protected branches
Signed-off-by:
Balasankar "Balu" C
<
balasankar@gitlab.com
>
parent
7bb880ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
spec/support/shared_examples/slack_mattermost_notifications_shared_examples.rb
...xamples/slack_mattermost_notifications_shared_examples.rb
+72
-0
No files found.
spec/support/shared_examples/slack_mattermost_notifications_shared_examples.rb
View file @
37e3b969
...
...
@@ -369,6 +369,48 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
end
end
context
'on a protected branch with protected branches defined using wildcards'
do
before
do
create
(
:protected_branch
,
project:
project
,
name:
'*-stable'
)
end
let
(
:data
)
do
Gitlab
::
DataBuilder
::
Push
.
build
(
project:
project
,
user:
user
,
ref:
'1-stable'
)
end
context
'pushing tags'
do
let
(
:data
)
do
Gitlab
::
DataBuilder
::
Push
.
build
(
project:
project
,
user:
user
,
ref:
"
#{
Gitlab
::
Git
::
TAG_REF_PREFIX
}
test"
)
end
it_behaves_like
"triggered
#{
service_name
}
service"
,
event_type:
"push"
end
context
'notification enabled only for default branch'
do
it_behaves_like
"untriggered
#{
service_name
}
service"
,
event_type:
"push"
,
branches_to_be_notified:
"default"
end
context
'notification enabled only for protected branches'
do
it_behaves_like
"triggered
#{
service_name
}
service"
,
event_type:
"push"
,
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:
"push"
,
branches_to_be_notified:
"default_and_protected"
end
context
'notification enabled for all branches'
do
it_behaves_like
"triggered
#{
service_name
}
service"
,
event_type:
"push"
,
branches_to_be_notified:
"all"
end
end
context
'on a neither protected nor default branch'
do
let
(
:data
)
do
Gitlab
::
DataBuilder
::
Push
.
build
(
...
...
@@ -570,6 +612,36 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
end
end
context
'on a protected branch with protected branches defined usin wildcards'
do
before
do
create
(
:protected_branch
,
project:
project
,
name:
'*-stable'
)
end
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
project:
project
,
status: :failed
,
sha:
project
.
commit
.
sha
,
ref:
'1-stable'
)
end
let
(
:data
)
{
Gitlab
::
DataBuilder
::
Pipeline
.
build
(
pipeline
)
}
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
context
'on a neither protected nor default branch'
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
...
...
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