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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
9e12baea
Commit
9e12baea
authored
Mar 02, 2019
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for evaluating bridge variables policy
parent
d14b1a71
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
spec/lib/gitlab/ci/build/policy/variables_spec.rb
spec/lib/gitlab/ci/build/policy/variables_spec.rb
+21
-0
No files found.
spec/lib/gitlab/ci/build/policy/variables_spec.rb
View file @
9e12baea
...
...
@@ -15,6 +15,7 @@ describe Gitlab::Ci::Build::Policy::Variables do
before
do
pipeline
.
variables
.
build
(
key:
'CI_PROJECT_NAME'
,
value:
''
)
pipeline
.
variables
.
build
(
key:
'MY_VARIABLE'
,
value:
'my-var'
)
end
describe
'#satisfied_by?'
do
...
...
@@ -24,6 +25,12 @@ describe Gitlab::Ci::Build::Policy::Variables do
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
end
it
'is satisfied by a matching pipeline variable'
do
policy
=
described_class
.
new
([
'$MY_VARIABLE'
])
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
end
it
'is not satisfied by an overridden empty variable'
do
policy
=
described_class
.
new
([
'$CI_PROJECT_NAME'
])
...
...
@@ -68,5 +75,19 @@ describe Gitlab::Ci::Build::Policy::Variables do
expect
(
pipeline
).
not_to
be_persisted
expect
(
seed
.
to_resource
).
not_to
be_persisted
end
context
'when a bridge job is used'
do
let
(
:bridge
)
do
build
(
:ci_bridge
,
pipeline:
pipeline
,
project:
project
,
ref:
'master'
)
end
let
(
:seed
)
{
double
(
'bridge seed'
,
to_resource:
bridge
)
}
it
'is satisfied by a matching expression for a bridge job'
do
policy
=
described_class
.
new
([
'$MY_VARIABLE'
])
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
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