diff options
Diffstat (limited to 'spec/features/projects/environments/environment_spec.rb')
-rw-r--r-- | spec/features/projects/environments/environment_spec.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index 056f4ee2e22..d12fe24714b 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -43,6 +43,58 @@ describe 'Environment' do end end + context 'when there is a successful deployment' do + let(:pipeline) { create(:ci_pipeline, project: project) } + let(:build) { create(:ci_build, :success, pipeline: pipeline) } + + let(:deployment) do + create(:deployment, :success, environment: environment, deployable: build) + end + + it 'does show deployments' do + expect(page).to have_link("#{build.name} (##{build.id})") + end + end + + context 'when there is a running deployment' do + let(:pipeline) { create(:ci_pipeline, project: project) } + let(:build) { create(:ci_build, pipeline: pipeline) } + + let(:deployment) do + create(:deployment, :running, environment: environment, deployable: build) + end + + it 'does show no deployments' do + expect(page).to have_content('You don\'t have any deployments right now.') + end + end + + context 'when there is a failed deployment' do + let(:pipeline) { create(:ci_pipeline, project: project) } + let(:build) { create(:ci_build, pipeline: pipeline) } + + let(:deployment) do + create(:deployment, :failed, environment: environment, deployable: build) + end + + it 'does show no deployments' do + expect(page).to have_content('You don\'t have any deployments right now.') + end + end + + context 'when there is a successful stop action' do + let(:pipeline) { create(:ci_pipeline, project: project) } + let(:build) { create(:ci_build, :success, pipeline: pipeline) } + + let(:deployment) do + create(:deployment, :success, :stop, environment: environment, deployable: build) + end + + it 'does show no deployments' do + expect(page).to have_content('You don\'t have any deployments right now.') + end + end + context 'with related deployable present' do let(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline) } |