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:
authorAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2016-11-09 01:29:55 +0300
committerAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2016-11-09 20:29:52 +0300
commit1a5a3be84080808554568a8c61a80cc6f3f536ed (patch)
tree186fd42de487f47c056f3992abadc97d4498e0c5 /spec/views
parentc70acb57f5adcd4f0a19f8e7d5bcb356464a9c64 (diff)
First pass at tests
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/projects/builds/show.html.haml_spec.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/views/projects/builds/show.html.haml_spec.rb b/spec/views/projects/builds/show.html.haml_spec.rb
index da43622d3f9..0e702d80bd3 100644
--- a/spec/views/projects/builds/show.html.haml_spec.rb
+++ b/spec/views/projects/builds/show.html.haml_spec.rb
@@ -17,6 +17,56 @@ describe 'projects/builds/show' do
allow(view).to receive(:can?).and_return(true)
end
+ describe 'environment info in build view' do
+ context 'build with latest deployment' do
+ let(:build) { create(:ci_build, :success, environment: 'staging') }
+ let(:environment) { create(:environment, name: 'staging') }
+ let!(:deployment) { create(:deployment, deployable: build) }
+
+ it 'shows deployment message' do
+ expect(rendered).to have_css('.environment-information', text: 'This build is the most recent deployment')
+ end
+ end
+
+ context 'build with outdated deployment' do
+ let(:build) { create(:ci_build, :success, environment: 'staging', pipeline: pipeline) }
+ let(:environment) { create(:environment, name: 'staging', project: project) }
+ let!(:deployment) { create(:deployment, environment: environment, deployable: build) }
+ let!(:newer_deployment) { create(:deployment, environment: environment, deployable: build) }
+
+ before do
+ assign(:build, build)
+ assign(:project, project)
+
+ allow(view).to receive(:can?).and_return(true)
+ render
+ end
+
+ it 'shows deployment message' do
+ expect(rendered).to have_css('.environment-information', text: "This build is an out-of-date deployment to #{environment.name}. View the most recent deployment #1")
+ end
+ end
+
+ context 'build failed to deploy' do
+ let(:build) { create(:ci_build, :failed, environment: 'staging') }
+ let!(:environment) { create(:environment, name: 'staging') }
+ end
+
+ context 'build will deploy' do
+ let(:build) { create(:ci_build, :running, environment: 'staging') }
+ let!(:environment) { create(:environment, name: 'staging') }
+ end
+
+ context 'build that failed to deploy and environment has not been created' do
+ let(:build) { create(:ci_build, :failed, environment: 'staging') }
+ 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') }
+ end
+ end
+
context 'when build is running' do
before do
build.run!