summaryrefslogtreecommitdiff
path: root/spec/models/ci/pipeline_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-11-02 16:18:21 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-11-02 16:18:21 +0800
commit80032a84dcaa06774a553863c48f011c3ec53367 (patch)
treec6e4b287cb7f4f213faa7ffa5e915c7d479a6918 /spec/models/ci/pipeline_spec.rb
parente90a555745fd99673916038ae053879a45462a6f (diff)
parent90072d61e167915a95c26a9af438ef5b6f1f0b03 (diff)
downloadgitlab-ce-80032a84dcaa06774a553863c48f011c3ec53367.tar.gz
Merge remote-tracking branch 'upstream/master' into pipeline-notifications
* upstream/master: (216 commits) Remove invalid changelog entries require rails/generators for generators Adds variable. Fixes changelog Fix haml_lint Fixes after review Update changelog Remove tooltips from project header Makes table pagination responsive 23545 Fix distorted project and group avatars Fix spinach tests Update links in side nav and header Allow to search for user by secondary email address in the admin interface Rename :name search parameter to :search_query at /admin/users Initialize Sidekiq with the list of queues used by GitLab Fix project features default values Add a link to the Issue Boards API in main README Add validation errors to Merge Request form Fix Markdown styling inside reference links Fix relative links in Markdown wiki when displayed in "Project" tab Adds label description to issue board title ...
Diffstat (limited to 'spec/models/ci/pipeline_spec.rb')
-rw-r--r--spec/models/ci/pipeline_spec.rb28
1 files changed, 12 insertions, 16 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 65e663be411..71b7628ef10 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -138,32 +138,26 @@ describe Ci::Pipeline, models: true do
describe 'state machine' do
let(:current) { Time.now.change(usec: 0) }
- let(:build) { create_build('build1', current, 10) }
- let(:build_b) { create_build('build2', current, 20) }
- let(:build_c) { create_build('build3', current + 50, 10) }
+ let(:build) { create_build('build1', 0) }
+ let(:build_b) { create_build('build2', 0) }
+ let(:build_c) { create_build('build3', 0) }
describe '#duration' do
before do
- pipeline.update(created_at: current)
-
- travel_to(current + 5) do
- pipeline.run
- pipeline.save
- end
-
travel_to(current + 30) do
- build.success
+ build.run!
+ build.success!
+ build_b.run!
+ build_c.run!
end
travel_to(current + 40) do
- build_b.drop
+ build_b.drop!
end
travel_to(current + 70) do
- build_c.success
+ build_c.success!
end
-
- pipeline.drop
end
it 'matches sum of builds duration' do
@@ -455,7 +449,9 @@ describe Ci::Pipeline, models: true do
context 'when all builds succeed' do
before do
build_a.success
- build_b.success
+
+ # We have to reload build_b as this is in next stage and it gets triggered by PipelineProcessWorker
+ build_b.reload.success
end
it 'receives a success event once' do