Commit f19e259f authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix duration specs

parent d8aed6a2
...@@ -144,31 +144,24 @@ describe Ci::Pipeline, models: true do ...@@ -144,31 +144,24 @@ describe Ci::Pipeline, models: true do
describe '#duration' do describe '#duration' do
before do before do
pipeline.update(created_at: current)
travel_to(current + 5) do
pipeline.run
pipeline.save
end
travel_to(current + 30) do travel_to(current + 30) do
build.success build.run!
build.success!
build_b.run!
build_c.run!
end end
travel_to(current + 40) do travel_to(current + 40) do
build_b.drop build_b.drop!
end end
travel_to(current + 70) do travel_to(current + 70) do
build_c.success build_c.success!
end end
# We have to reload pipeline, because its status is updated by processing builds
pipeline.reload.drop
end end
it 'matches sum of builds duration' do it 'matches sum of builds duration' do
binding.pry pipeline.reload
expect(pipeline.duration).to eq(40) expect(pipeline.duration).to eq(40)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment