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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
45bd5391
Commit
45bd5391
authored
Nov 09, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend tests for service that stops environment
parent
ae8a461d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
1 deletion
+49
-1
spec/services/ci/stop_environment_service_spec.rb
spec/services/ci/stop_environment_service_spec.rb
+49
-1
No files found.
spec/services/ci/stop_environment_service_spec.rb
View file @
45bd5391
...
...
@@ -7,7 +7,7 @@ describe Ci::StopEnvironmentService, services: true do
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
describe
'#execute'
do
context
'when environment exists'
do
context
'when environment
with review app
exists'
do
before
do
create
(
:environment
,
:with_review_app
,
project:
project
)
end
...
...
@@ -17,6 +17,54 @@ describe Ci::StopEnvironmentService, services: true do
service
.
execute
(
'master'
)
end
context
'when specified branch does not exist'
do
it
'does not stop environment'
do
expect_any_instance_of
(
Environment
).
not_to
receive
(
:stop!
)
service
.
execute
(
'non/existent/branch'
)
end
end
context
'when no branch not specified'
do
it
'does not stop environment'
do
expect_any_instance_of
(
Environment
).
not_to
receive
(
:stop!
)
service
.
execute
(
nil
)
end
end
context
'when environment is not stoppable'
do
before
do
allow_any_instance_of
(
Environment
)
.
to
receive
(
:stoppable?
).
and_return
(
false
)
end
it
'does not stop environment'
do
expect_any_instance_of
(
Environment
).
not_to
receive
(
:stop!
)
service
.
execute
(
'master'
)
end
end
end
context
'when there is no environment associated with review app'
do
before
do
create
(
:environment
,
project:
project
)
end
it
'does not stop environment'
do
expect_any_instance_of
(
Environment
).
not_to
receive
(
:stop!
)
service
.
execute
(
'master'
)
end
end
context
'when environment does not exist'
do
it
'does not raise error'
do
expect
{
service
.
execute
(
'master'
)
}
.
not_to
raise_error
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