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
601fba38
Commit
601fba38
authored
Jan 30, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add EE specific VariableEntity logic
parent
79619560
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
app/serializers/variable_entity.rb
app/serializers/variable_entity.rb
+2
-0
ee/app/serializers/ee/variable_entity.rb
ee/app/serializers/ee/variable_entity.rb
+9
-0
spec/ee/spec/serializers/ee/variable_entity_spec.rb
spec/ee/spec/serializers/ee/variable_entity_spec.rb
+30
-0
No files found.
app/serializers/variable_entity.rb
View file @
601fba38
class
VariableEntity
<
Grape
::
Entity
prepend
::
EE
::
VariableEntity
expose
:id
expose
:key
expose
:value
...
...
ee/app/serializers/ee/variable_entity.rb
0 → 100644
View file @
601fba38
module
EE
module
VariableEntity
extend
ActiveSupport
::
Concern
prepended
do
expose
:environment_scope
,
if:
->
(
variable
,
options
)
{
variable
.
project
.
feature_available?
(
:variable_environment_scope
)
}
end
end
end
spec/ee/spec/serializers/ee/variable_entity_spec.rb
0 → 100644
View file @
601fba38
require
'spec_helper'
describe
VariableEntity
do
let
(
:variable
)
{
create
(
:ci_variable
)
}
let
(
:entity
)
{
described_class
.
new
(
variable
)
}
describe
'#as_json'
do
subject
{
entity
.
as_json
}
context
'when project has variable environment scopes available'
do
before
do
allow
(
variable
.
project
).
to
receive
(
:feature_available?
).
with
(
:variable_environment_scope
).
and_return
(
true
)
end
it
'contains the environment_scope field'
do
expect
(
subject
).
to
include
(
:environment_scope
)
end
end
context
'when project does not have variable environment scopes available'
do
before
do
allow
(
variable
.
project
).
to
receive
(
:feature_available?
).
with
(
:variable_environment_scope
).
and_return
(
false
)
end
it
'does not contain the environment_scope field'
do
expect
(
subject
).
not_to
include
(
:environment_scope
)
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