2015-08-25 21:42:46 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-09 05:55:36 -05:00
|
|
|
describe Ci::Charts, lib: true do
|
2015-08-25 21:42:46 -04:00
|
|
|
context "build_times" do
|
2016-08-11 16:54:25 -04:00
|
|
|
let(:project) { create(:empty_project) }
|
|
|
|
let(:chart) { Ci::Charts::BuildTime.new(project) }
|
|
|
|
|
|
|
|
subject { chart.build_times }
|
|
|
|
|
2015-08-25 21:42:46 -04:00
|
|
|
before do
|
2016-08-11 16:54:25 -04:00
|
|
|
create(:ci_empty_pipeline, project: project, duration: 120)
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'returns build times in minutes' do
|
2016-08-11 16:54:25 -04:00
|
|
|
is_expected.to contain_exactly(2)
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
2016-05-23 02:35:18 -04:00
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'handles nil build times' do
|
2016-08-11 16:54:25 -04:00
|
|
|
create(:ci_empty_pipeline, project: project, duration: nil)
|
2016-05-23 02:35:18 -04:00
|
|
|
|
2016-08-11 16:54:25 -04:00
|
|
|
is_expected.to contain_exactly(2, 0)
|
2016-05-23 02:35:18 -04:00
|
|
|
end
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|