2015-09-25 12:07:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
describe Ci::Charts, lib: true do
|
2015-09-25 12:07:36 +05:30
|
|
|
context "build_times" do
|
|
|
|
before do
|
2016-06-16 23:09:34 +05:30
|
|
|
@pipeline = FactoryGirl.create(:ci_pipeline)
|
|
|
|
FactoryGirl.create(:ci_build, pipeline: @pipeline)
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'should return build times in minutes' do
|
2016-06-16 23:09:34 +05:30
|
|
|
chart = Ci::Charts::BuildTime.new(@pipeline.project)
|
2015-09-25 12:07:36 +05:30
|
|
|
expect(chart.build_times).to eq([2])
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
it 'should handle nil build times' do
|
2016-06-16 23:09:34 +05:30
|
|
|
create(:ci_pipeline, duration: nil, project: @pipeline.project)
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
chart = Ci::Charts::BuildTime.new(@pipeline.project)
|
2016-06-02 11:05:42 +05:30
|
|
|
expect(chart.build_times).to eq([2, 0])
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
end
|