Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-11-23 16:18:06 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-11-23 16:25:48 +0300
commit02c6cbf53f4799bc888db7767c2d9a5e04a30002 (patch)
tree17dfbb66b3e896a407bd3dbd0ad96982496f3264 /spec/views
parentafa5afc5e38633126c4c5d318c246239b074155c (diff)
Add tests
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/projects/builds/show.html.haml_spec.rb52
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