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
Léo-Paul Géneau
gitlab-ce
Commits
a745eadf
Commit
a745eadf
authored
Mar 27, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs for pipeline variables expressions policy
parent
b1ce3ba1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
spec/lib/gitlab/ci/build/policy/variables_spec.rb
spec/lib/gitlab/ci/build/policy/variables_spec.rb
+10
-4
No files found.
spec/lib/gitlab/ci/build/policy/variables_spec.rb
View file @
a745eadf
...
...
@@ -4,7 +4,7 @@ describe Gitlab::Ci::Build::Policy::Variables do
set
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
do
build
(
:ci_empty_pipeline
,
project:
project
,
ref:
'master'
)
build
(
:ci_empty_pipeline
,
project:
project
,
ref:
'master'
,
source: :push
)
end
let
(
:ci_build
)
do
...
...
@@ -18,7 +18,7 @@ describe Gitlab::Ci::Build::Policy::Variables do
end
describe
'#satisfied_by?'
do
it
'is satisfied by a
defined and existing variable
'
do
it
'is satisfied by a
t least one matching statement
'
do
policy
=
described_class
.
new
([
'$CI_PROJECT_ID'
,
'$UNDEFINED'
])
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
...
...
@@ -31,7 +31,7 @@ describe Gitlab::Ci::Build::Policy::Variables do
end
it
'is satisfied by a truthy pipeline expression'
do
policy
=
described_class
.
new
([
%($CI_PIPELINE_SOURCE == "
#{pipeline.source}
")
])
policy
=
described_class
.
new
([
%($CI_PIPELINE_SOURCE == "
push
")
])
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
end
...
...
@@ -43,11 +43,17 @@ describe Gitlab::Ci::Build::Policy::Variables do
end
it
'is satisfied by a truthy expression using undefined variable'
do
policy
=
described_class
.
new
([
'$UNDEFINED
'
,
'$UNDEFINED
== null'
])
policy
=
described_class
.
new
([
'$UNDEFINED == null'
])
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
end
it
'is not satisfied by a falsy expression using undefined variable'
do
policy
=
described_class
.
new
([
'$UNDEFINED'
])
expect
(
policy
).
not_to
be_satisfied_by
(
pipeline
,
seed
)
end
it
'allows to evaluate regular secret variables'
do
create
(
:ci_variable
,
project:
project
,
key:
'SECRET'
,
value:
'my secret'
)
...
...
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