diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-08-15 21:32:36 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-08-15 21:32:36 +0800 |
commit | ce641335167230d288fbb2ec277548acbaff9dd7 (patch) | |
tree | 558c3a2c7bdded443da9229365a68c4308841c11 /spec/models/ci | |
parent | 0ea81ae50a702c7341b1bd6fd15002ee78ac4964 (diff) | |
download | gitlab-ce-ce641335167230d288fbb2ec277548acbaff9dd7.tar.gz |
Introduce Gitlab::Utils.now so that it's easier to stub
Diffstat (limited to 'spec/models/ci')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 8137e9f8f71..67bd23a1ccb 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -129,12 +129,15 @@ describe Ci::Pipeline, models: true do describe '#duration' do before do - build.skip - build2.skip + allow(Gitlab::Utils).to receive(:now). + and_return(current - 120, current) + + pipeline.run + pipeline.succeed end it 'matches sum of builds duration' do - expect(pipeline.reload.duration).to eq(build.duration + build2.duration) + expect(pipeline.reload.duration).to eq(120) end end |