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
1a627041
Commit
1a627041
authored
Mar 27, 2018
by
Grzegorz Bizon
Committed by
Grzegorz Bizon
Mar 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs for predefined build variables
parent
d609eaed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
spec/lib/gitlab/ci/build/policy/variables_spec.rb
spec/lib/gitlab/ci/build/policy/variables_spec.rb
+2
-4
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+20
-6
No files found.
spec/lib/gitlab/ci/build/policy/variables_spec.rb
View file @
1a627041
...
@@ -49,11 +49,9 @@ describe Gitlab::Ci::Build::Policy::Variables do
...
@@ -49,11 +49,9 @@ describe Gitlab::Ci::Build::Policy::Variables do
end
end
it
'allows to evaluate regular secret variables'
do
it
'allows to evaluate regular secret variables'
do
secret
=
create
(
:ci_variable
,
project:
project
,
create
(
:ci_variable
,
project:
project
,
key:
'SECRET'
,
value:
'my secret'
)
key:
'SECRET'
,
value:
'secret value'
)
policy
=
described_class
.
new
([
"$SECRET == '
secret value
'"
])
policy
=
described_class
.
new
([
"$SECRET == '
my secret
'"
])
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
end
end
...
...
spec/models/ci/build_spec.rb
View file @
1a627041
...
@@ -2096,14 +2096,28 @@ describe Ci::Build do
...
@@ -2096,14 +2096,28 @@ describe Ci::Build do
end
end
describe
'#variables_hash'
do
describe
'#variables_hash'
do
before
do
context
'when overriding secret variables'
do
project
.
variables
.
create!
(
key:
'MY_VAR'
,
value:
'my value 1'
)
before
do
pipeline
.
variables
.
create!
(
key:
'MY_VAR'
,
value:
'my value 2'
)
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 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
end
it
'returns a regular hash created in valid order'
do
context
'when overriding user-provided variables'
do
expect
(
build
.
variables_hash
).
to
include
(
'MY_VAR'
:
'my value 2'
)
before
do
expect
(
build
.
variables_hash
).
not_to
include
(
'MY_VAR'
:
'my value 1'
)
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
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