diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-23 14:18:06 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-23 14:25:48 +0100 |
commit | 02c6cbf53f4799bc888db7767c2d9a5e04a30002 (patch) | |
tree | 17dfbb66b3e896a407bd3dbd0ad96982496f3264 /spec/views | |
parent | afa5afc5e38633126c4c5d318c246239b074155c (diff) | |
download | gitlab-ce-02c6cbf53f4799bc888db7767c2d9a5e04a30002.tar.gz |
Add tests
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/builds/show.html.haml_spec.rb | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/spec/views/projects/builds/show.html.haml_spec.rb b/spec/views/projects/builds/show.html.haml_spec.rb index e0c77201116..869dcb417e6 100644 --- a/spec/views/projects/builds/show.html.haml_spec.rb +++ b/spec/views/projects/builds/show.html.haml_spec.rb @@ -88,16 +88,46 @@ describe 'projects/builds/show', :view 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) + context 'and environment does exist' do + 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 + + context 'and has deployment' do + let!(:deployment) do + create(:deployment, environment: environment) + end + + it 'shows that deployment will be overwritten' do + expected_text = 'This build is creating a deployment to staging' + render + + expect(rendered).to have_css( + '.environment-information', text: expected_text) + expect(rendered).to have_css( + '.environment-information', text: 'latest deployment') + end + end + end + + context 'and environment does not exist' do + 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) + expect(rendered).not_to have_css( + '.environment-information', text: 'latest deployment') + end end end @@ -134,6 +164,8 @@ describe 'projects/builds/show', :view do expect(rendered).to have_css( '.environment-information', text: expected_text) + expect(rendered).not_to have_css( + '.environment-information', text: 'latest deployment') end end end |