debian-mirror-gitlab/spec/lib/ci/charts_spec.rb

25 lines
565 B
Ruby
Raw Normal View History

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
2016-09-13 17:45:13 +05:30
let(:project) { create(:empty_project) }
let(:chart) { Ci::Charts::BuildTime.new(project) }
subject { chart.build_times }
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
2016-09-13 17:45:13 +05:30
it 'returns build times in minutes' do
is_expected.to contain_exactly(2)
2015-09-25 12:07:36 +05:30
end
2016-06-02 11:05:42 +05:30
2016-09-13 17:45:13 +05:30
it 'handles nil build times' do
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