summaryrefslogtreecommitdiff
path: root/spec/lib/ci/charts_spec.rb
blob: 8e2d27244261bb459f71a1bb5ab0cff9b74fff1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'spec_helper'

describe Ci::Charts do
  context "pipeline_times" do
    let(:project) { create(:empty_project) }
    let(:chart) { Ci::Charts::PipelineTime.new(project) }

    subject { chart.pipeline_times }

    before do
      create(:ci_empty_pipeline, project: project, duration: 120)
    end

    it 'returns pipeline times in minutes' do
      is_expected.to contain_exactly(2)
    end

    it 'handles nil pipeline times' do
      create(:ci_empty_pipeline, project: project, duration: nil)

      is_expected.to contain_exactly(2, 0)
    end
  end
end