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
7da88278
Commit
7da88278
authored
Jun 01, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure protected can't be null; Test protected!
parent
0ab8c852
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
db/schema.rb
db/schema.rb
+2
-2
spec/models/ci/variable_spec.rb
spec/models/ci/variable_spec.rb
+24
-2
No files found.
db/schema.rb
View file @
7da88278
...
...
@@ -356,7 +356,7 @@ ActiveRecord::Schema.define(version: 20170525174156) do
t
.
string
"encrypted_value_salt"
t
.
string
"encrypted_value_iv"
t
.
integer
"project_id"
,
null:
false
t
.
boolean
"protected"
,
default:
false
t
.
boolean
"protected"
,
default:
false
,
null:
false
end
add_index
"ci_variables"
,
[
"project_id"
],
name:
"index_ci_variables_on_project_id"
,
using: :btree
...
...
spec/models/ci/variable_spec.rb
View file @
7da88278
...
...
@@ -12,11 +12,33 @@ describe Ci::Variable, models: true do
it
{
is_expected
.
not_to
allow_value
(
'foo bar'
).
for
(
:key
)
}
it
{
is_expected
.
not_to
allow_value
(
'foo/bar'
).
for
(
:key
)
}
before
:each
do
subject
.
value
=
secret_value
describe
'.unprotected'
do
subject
{
described_class
.
unprotected
}
context
'when variable is protected'
do
before
do
create
(
:ci_variable
,
:protected
)
end
it
'returns nothing'
do
is_expected
.
to
be_empty
end
end
context
'when variable is not protected'
do
let
(
:variable
)
{
create
(
:ci_variable
,
protected:
false
)
}
it
'returns the variable'
do
is_expected
.
to
contain_exactly
(
variable
)
end
end
end
describe
'#value'
do
before
do
subject
.
value
=
secret_value
end
it
'stores the encrypted value'
do
expect
(
subject
.
encrypted_value
).
not_to
be_nil
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