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
081b179b
Commit
081b179b
authored
Apr 01, 2020
by
Maxime Orefice
Committed by
Dmytro Zaporozhets
Apr 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
De-duplicate environment entity EE specs
parent
db0673b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
41 deletions
+29
-41
.rubocop.yml
.rubocop.yml
+0
-2
ee/spec/serializers/ee/environment_entity_spec.rb
ee/spec/serializers/ee/environment_entity_spec.rb
+0
-34
ee/spec/serializers/environment_entity_spec.rb
ee/spec/serializers/environment_entity_spec.rb
+29
-5
No files found.
.rubocop.yml
View file @
081b179b
...
...
@@ -217,7 +217,6 @@ Gitlab/DuplicateSpecLocation:
-
ee/spec/helpers/auth_helper_spec.rb
-
ee/spec/lib/gitlab/gl_repository_spec.rb
-
ee/spec/models/namespace_spec.rb
-
ee/spec/serializers/environment_entity_spec.rb
-
ee/spec/services/issues/create_service_spec.rb
-
ee/spec/services/merge_requests/create_service_spec.rb
-
ee/spec/services/merge_requests/refresh_service_spec.rb
...
...
@@ -225,7 +224,6 @@ Gitlab/DuplicateSpecLocation:
-
ee/spec/services/system_hooks_service_spec.rb
-
ee/spec/helpers/ee/auth_helper_spec.rb
-
ee/spec/models/ee/namespace_spec.rb
-
ee/spec/serializers/ee/environment_entity_spec.rb
-
ee/spec/services/ee/issues/create_service_spec.rb
-
ee/spec/services/ee/merge_requests/create_service_spec.rb
-
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
...
...
ee/spec/serializers/ee/environment_entity_spec.rb
deleted
100644 → 0
View file @
db0673b1
# frozen_string_literal: true
require
'spec_helper'
describe
EnvironmentEntity
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:environment
)
{
create
(
:environment
,
:with_review_app
,
ref:
'development'
,
project:
project
)
}
let
(
:protected_environment
)
{
create
(
:protected_environment
,
name:
environment
.
name
,
project:
project
)
}
let
(
:entity
)
do
described_class
.
new
(
environment
,
request:
double
(
current_user:
user
,
project:
project
))
end
before
do
project
.
repository
.
add_branch
(
user
,
'development'
,
project
.
commit
.
id
)
end
describe
'#can_stop'
do
subject
{
entity
.
as_json
[
:can_stop
]
}
it_behaves_like
'protected environments access'
end
describe
'#terminal_path'
do
subject
{
entity
.
as_json
.
include?
(
:terminal_path
)
}
before
do
allow
(
environment
).
to
receive
(
:has_terminals?
).
and_return
(
true
)
end
it_behaves_like
'protected environments access'
,
false
end
end
ee/spec/serializers/environment_entity_spec.rb
View file @
081b179b
...
...
@@ -7,13 +7,10 @@ describe EnvironmentEntity do
let
(
:user
)
{
create
(
:user
)
}
let
(
:environment
)
{
create
(
:environment
)
}
before
do
environment
.
project
.
add_maintainer
(
user
)
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:entity
)
do
described_class
.
new
(
environment
,
request:
double
(
current_user:
user
))
described_class
.
new
(
environment
,
request:
double
(
current_user:
user
,
project:
project
))
end
describe
'#as_json'
do
...
...
@@ -28,6 +25,7 @@ describe EnvironmentEntity do
before
do
allow
(
environment
).
to
receive
(
:has_terminals?
).
and_return
(
true
)
allow
(
environment
).
to
receive
(
:rollout_status
).
and_return
(
kube_deployment_rollout_status
)
environment
.
project
.
add_maintainer
(
user
)
end
it
'exposes rollout_status'
do
...
...
@@ -45,5 +43,31 @@ describe EnvironmentEntity do
expect
(
subject
).
not_to
include
(
:rollout_status
)
end
end
context
'when environment has a review app'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:environment
)
{
create
(
:environment
,
:with_review_app
,
ref:
'development'
,
project:
project
)
}
let
(
:protected_environment
)
{
create
(
:protected_environment
,
name:
environment
.
name
,
project:
project
)
}
before
do
project
.
repository
.
add_branch
(
user
,
'development'
,
project
.
commit
.
id
)
end
describe
'#can_stop'
do
subject
{
entity
.
as_json
[
:can_stop
]
}
it_behaves_like
'protected environments access'
end
describe
'#terminal_path'
do
before
do
allow
(
environment
).
to
receive
(
:has_terminals?
).
and_return
(
true
)
end
subject
{
entity
.
as_json
.
include?
(
:terminal_path
)
}
it_behaves_like
'protected environments access'
,
false
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