diff options
author | Dakkaron <dak1st@gmx.at> | 2018-03-05 17:07:52 +0100 |
---|---|---|
committer | Dakkaron <dak1st@gmx.at> | 2018-03-06 17:01:26 +0100 |
commit | 44177cea3811b450ae65a9dbeb51dac9d0ef5253 (patch) | |
tree | 59daa3dac836c86a639837a6000b3f46412107b4 /spec | |
parent | fc9955ce8da200e58fe8fcfef68f02344bfd8390 (diff) | |
download | gitlab-ce-44177cea3811b450ae65a9dbeb51dac9d0ef5253.tar.gz |
CI charts now include the current day
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/ci/charts_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/charts_spec.rb b/spec/lib/gitlab/ci/charts_spec.rb index f8188675013..1668d3bbaac 100644 --- a/spec/lib/gitlab/ci/charts_spec.rb +++ b/spec/lib/gitlab/ci/charts_spec.rb @@ -1,6 +1,51 @@ require 'spec_helper' describe Gitlab::Ci::Charts do + context "yearchart" do + let(:project) { create(:project) } + let(:chart) { Gitlab::Ci::Charts::YearChart.new(project) } + + subject { chart.to } + + it 'goes until the end of the current month (including the whole last day of the month)' do + is_expected.to eq(Date.today.end_of_month.end_of_day) + end + + it 'starts at the beginning of the current year' do + expect(chart.from).to eq(chart.to.years_ago(1).beginning_of_month.beginning_of_day) + end + end + + context "monthchart" do + let(:project) { create(:project) } + let(:chart) { Gitlab::Ci::Charts::MonthChart.new(project) } + + subject { chart.to } + + it 'includes the whole current day' do + is_expected.to eq(Date.today.end_of_day) + end + + it 'starts one month ago' do + expect(chart.from).to eq(1.month.ago.beginning_of_day) + end + end + + context "weekchart" do + let(:project) { create(:project) } + let(:chart) { Gitlab::Ci::Charts::WeekChart.new(project) } + + subject { chart.to } + + it 'includes the whole current day' do + is_expected.to eq(Date.today.end_of_day) + end + + it 'starts one week ago' do + expect(chart.from).to eq(1.week.ago.beginning_of_day) + end + end + context "pipeline_times" do let(:project) { create(:project) } let(:chart) { Gitlab::Ci::Charts::PipelineTime.new(project) } |