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
547df08d
Commit
547df08d
authored
Apr 09, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE specific specs from environment_entity
parent
58adbd12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
33 deletions
+50
-33
ee/spec/serializers/environment_entity_spec.rb
ee/spec/serializers/environment_entity_spec.rb
+47
-0
spec/serializers/environment_entity_spec.rb
spec/serializers/environment_entity_spec.rb
+3
-33
No files found.
ee/spec/serializers/environment_entity_spec.rb
0 → 100644
View file @
547df08d
require
'spec_helper'
describe
EnvironmentEntity
do
include
KubernetesHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:environment
)
{
create
(
:environment
)
}
before
do
environment
.
project
.
add_maintainer
(
user
)
end
let
(
:entity
)
do
described_class
.
new
(
environment
,
request:
double
(
current_user:
user
))
end
describe
'#as_json'
do
subject
{
entity
.
as_json
}
context
'when deploy_boards are available'
do
before
do
stub_licensed_features
(
deploy_board:
true
)
end
context
'with deployment service ready'
do
before
do
allow
(
environment
).
to
receive
(
:has_terminals?
).
and_return
(
true
)
allow
(
environment
).
to
receive
(
:rollout_status
).
and_return
(
kube_deployment_rollout_status
)
end
it
'exposes rollout_status'
do
expect
(
subject
).
to
include
(
:rollout_status
)
end
end
end
context
'when deploy_boards are not available'
do
before
do
allow
(
environment
).
to
receive
(
:has_terminals?
).
and_return
(
true
)
end
it
'does not expose rollout_status'
do
expect
(
subject
).
not_to
include
(
:rollout_status
)
end
end
end
end
spec/serializers/environment_entity_spec.rb
View file @
547df08d
require
'spec_helper'
require
'spec_helper'
describe
EnvironmentEntity
do
describe
EnvironmentEntity
do
include
KubernetesHelpers
let
(
:request
)
{
double
(
'request'
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:environment
)
{
create
(
:environment
)
}
let
(
:entity
)
do
let
(
:entity
)
do
described_class
.
new
(
environment
,
request:
double
(
current_user:
user
))
described_class
.
new
(
environment
,
request:
spy
(
'request'
))
end
end
let
(
:environment
)
{
create
(
:environment
)
}
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
before
do
environment
.
project
.
add_maintainer
(
user
)
end
it
'exposes latest deployment'
do
it
'exposes latest deployment'
do
expect
(
subject
).
to
include
(
:last_deployment
)
expect
(
subject
).
to
include
(
:last_deployment
)
end
end
...
@@ -48,29 +41,6 @@ describe EnvironmentEntity do
...
@@ -48,29 +41,6 @@ describe EnvironmentEntity do
end
end
end
end
context
'with deployment service ready'
do
before
do
stub_licensed_features
(
deploy_board:
true
)
allow
(
environment
).
to
receive
(
:has_terminals?
).
and_return
(
true
)
allow
(
environment
).
to
receive
(
:rollout_status
).
and_return
(
kube_deployment_rollout_status
)
end
it
'exposes rollout_status'
do
expect
(
subject
).
to
include
(
:rollout_status
)
end
end
context
'when license does not has the GitLab_DeployBoard add-on'
do
before
do
stub_licensed_features
(
deploy_board:
false
)
allow
(
environment
).
to
receive
(
:has_terminals?
).
and_return
(
true
)
end
it
'does not expose rollout_status'
do
expect
(
subject
[
:rollout_status_path
]).
to
be_blank
end
end
context
'with deployment platform'
do
context
'with deployment platform'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
...
...
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