Skip to content
Snippets Groups Projects
Commit ceb06983 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Make it possible to fabricate environment on branch

parent 990765ed
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -8,16 +8,21 @@
trait :with_review_app do |environment|
project
 
transient do
ref 'master'
end
# At this point `review app` is an ephemeral concept related to
# deployments being deployed for given environment. There is no
# first-class `review app` available so we need to create set of
# interconnected objects to simulate a review app.
#
after(:create) do |environment|
after(:create) do |environment, evaluator|
deployment = create(:deployment,
environment: environment,
project: environment.project,
sha: environment.project.commit.id)
ref: evaluator.ref,
sha: environment.project.commit(evaluator.ref).id)
 
teardown_build = create(:ci_build, :manual,
name: "#{deployment.environment.name}:teardown",
Loading
Loading
Loading
Loading
@@ -9,7 +9,8 @@
describe '#execute' do
context 'when environment with review app exists' do
before do
create(:environment, :with_review_app, project: project)
create(:environment, :with_review_app, project: project,
ref: 'feature')
end
 
context 'when user has permission to stop environment' do
Loading
Loading
@@ -17,8 +18,16 @@
project.team << [user, :developer]
end
 
it 'stops environment' do
expect_environment_stopped_on('master')
context 'when environment is associated with removed branch' do
it 'stops environment' do
expect_environment_stopped_on('feature')
end
end
context 'when environment is associated with different branch' do
it 'does not stop environment' do
expect_environment_not_stopped_on('master')
end
end
 
context 'when specified branch does not exist' do
Loading
Loading
@@ -40,7 +49,7 @@
end
 
it 'does not stop environment' do
expect_environment_not_stopped_on('master')
expect_environment_not_stopped_on('feature')
end
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment