2015-09-25 12:07:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe Gitlab::Ci::Charts do
|
2017-09-10 17:25:29 +05:30
|
|
|
context "pipeline_times" do
|
|
|
|
let(:project) { create(:project) }
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:chart) { Gitlab::Ci::Charts::PipelineTime.new(project) }
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
subject { chart.pipeline_times }
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
before do
|
2016-09-13 17:45:13 +05:30
|
|
|
create(:ci_empty_pipeline, project: project, duration: 120)
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
it 'returns pipeline times in minutes' do
|
2016-09-13 17:45:13 +05:30
|
|
|
is_expected.to contain_exactly(2)
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
it 'handles nil pipeline times' do
|
2016-09-13 17:45:13 +05:30
|
|
|
create(:ci_empty_pipeline, project: project, duration: nil)
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
is_expected.to contain_exactly(2, 0)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
end
|