diff options
author | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2016-11-09 15:30:58 -0600 |
---|---|---|
committer | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2016-11-09 16:39:49 -0600 |
commit | 2b8292cd49dbc68b02f46f865b7115191bf2de07 (patch) | |
tree | 7cbe1e95762d39c2545920c15332c62bbe079869 /spec/views | |
parent | d7ba85c7496fb24625f3ebf3e78af42ec23e842e (diff) | |
download | gitlab-ce-2b8292cd49dbc68b02f46f865b7115191bf2de07.tar.gz |
Finish specs for environment info
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/builds/show.html.haml_spec.rb | 68 |
1 files changed, 60 insertions, 8 deletions
diff --git a/spec/views/projects/builds/show.html.haml_spec.rb b/spec/views/projects/builds/show.html.haml_spec.rb index 98b68e730e6..fa4d66bb6cb 100644 --- a/spec/views/projects/builds/show.html.haml_spec.rb +++ b/spec/views/projects/builds/show.html.haml_spec.rb @@ -28,7 +28,6 @@ describe 'projects/builds/show', :view do it 'shows deployment message' do expected_text = 'This build is the most recent deployment' - render expect(rendered).to have_css( @@ -63,22 +62,75 @@ describe 'projects/builds/show', :view do end context 'build failed to deploy' do - let(:build) { create(:ci_build, :failed, environment: 'staging') } - let!(:environment) { create(:environment, name: 'staging') } + let(:build) do + create(:ci_build, :failed, environment: 'staging', pipeline: pipeline) + end + + let!(:environment) do + create(:environment, name: 'staging', project: project) + end + + it 'shows deployment message' do + expected_text = 'The deployment of this build to staging did not complete.' + render + + expect(rendered).to have_css( + '.environment-information', text: expected_text) + end end context 'build will deploy' do - let(:build) { create(:ci_build, :running, environment: 'staging') } - let!(:environment) { create(:environment, name: 'staging') } + let(:build) do + create(:ci_build, :running, environment: 'staging', pipeline: pipeline) + end + + let!(:environment) do + create(:environment, name: 'staging', project: project) + end + + it 'shows deployment message' do + expected_text = 'This build is creating a deployment to staging' + render + + expect(rendered).to have_css( + '.environment-information', text: expected_text) + end end context 'build that failed to deploy and environment has not been created' do - let(:build) { create(:ci_build, :failed, environment: 'staging') } + let(:build) do + create(:ci_build, :failed, environment: 'staging', pipeline: pipeline) + end + + let!(:environment) do + create(:environment, name: 'staging', project: project) + end + + it 'shows deployment message' do + expected_text = 'The deployment of this build to staging did not complete' + render + + expect(rendered).to have_css( + '.environment-information', text: expected_text) + end end context 'build that will deploy and environment has not been created' do - let(:build) { create(:ci_build, :running, environment: 'staging') } - let!(:environment) { create(:environment, name: 'staging') } + let(:build) do + create(:ci_build, :running, environment: 'staging', pipeline: pipeline) + end + + let!(:environment) do + create(:environment, name: 'staging', project: project) + end + + it 'shows deployment message' do + expected_text = 'This build is creating a deployment to staging' + render + + expect(rendered).to have_css( + '.environment-information', text: expected_text) + end end end |