BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
b1ce3ba1
Commit
b1ce3ba1
authored
Mar 27, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs for predefined build variables
parent
a60ccef9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
variables_spec.rb
spec/lib/gitlab/ci/build/policy/variables_spec.rb
+2
-4
build_spec.rb
spec/models/ci/build_spec.rb
+15
-1
No files found.
spec/lib/gitlab/ci/build/policy/variables_spec.rb
View file @
b1ce3ba1
...
...
@@ -49,11 +49,9 @@ describe Gitlab::Ci::Build::Policy::Variables do
end
it
'allows to evaluate regular secret variables'
do
secret
=
create
(
:ci_variable
,
project:
project
,
key:
'SECRET'
,
value:
'secret value'
)
create
(
:ci_variable
,
project:
project
,
key:
'SECRET'
,
value:
'my secret'
)
policy
=
described_class
.
new
([
"$SECRET == '
secret value
'"
])
policy
=
described_class
.
new
([
"$SECRET == '
my secret
'"
])
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
end
...
...
spec/models/ci/build_spec.rb
View file @
b1ce3ba1
...
...
@@ -2054,17 +2054,31 @@ describe Ci::Build do
end
describe
'#variables_hash'
do
context
'when overriding secret variables'
do
before
do
project
.
variables
.
create!
(
key:
'MY_VAR'
,
value:
'my value 1'
)
pipeline
.
variables
.
create!
(
key:
'MY_VAR'
,
value:
'my value 2'
)
end
it
'returns a regular hash created in valid order
'
do
it
'returns a regular hash created using valid ordering
'
do
expect
(
build
.
variables_hash
).
to
include
(
'MY_VAR'
:
'my value 2'
)
expect
(
build
.
variables_hash
).
not_to
include
(
'MY_VAR'
:
'my value 1'
)
end
end
context
'when overriding user-provided variables'
do
before
do
pipeline
.
variables
.
build
(
key:
'MY_VAR'
,
value:
'pipeline value'
)
build
.
yaml_variables
=
[{
key:
'MY_VAR'
,
value:
'myvar'
,
public:
true
}]
end
it
'returns a hash including variable with higher precedence'
do
expect
(
build
.
variables_hash
).
to
include
(
'MY_VAR'
:
'pipeline value'
)
expect
(
build
.
variables_hash
).
not_to
include
(
'MY_VAR'
:
'myvar'
)
end
end
end
describe
'state transition: any => [:pending]'
do
let
(
:build
)
{
create
(
:ci_build
,
:created
)
}
...
...
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