diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb')
-rw-r--r-- | spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb b/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb index 21503dc1501..76578340f7b 100644 --- a/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb @@ -218,7 +218,7 @@ RSpec.describe Gitlab::CycleAnalytics::StageSummary do context 'when `to` is given' do before do - Timecop.freeze(5.days.from_now) { create(:deployment, :success, project: project) } + Timecop.freeze(5.days.from_now) { create(:deployment, :success, project: project, finished_at: Time.zone.now) } end it 'finds records created between `from` and `to` range' do @@ -230,12 +230,34 @@ RSpec.describe Gitlab::CycleAnalytics::StageSummary do end context 'when `from` and `to` are within a day' do - it 'returns the number of deployments made on that day' do - freeze_time do - create(:deployment, :success, project: project) - options[:from] = options[:to] = Time.now + context 'when query_deploymenys_via_finished_at_in_vsa feature flag is off' do + before do + stub_feature_flags(query_deploymenys_via_finished_at_in_vsa: false) + end + + it 'returns the number of deployments made on that day' do + freeze_time do + create(:deployment, :success, project: project) + options[:from] = options[:to] = Time.zone.now + + expect(subject).to eq('1') + end + end + end + + context 'when query_deploymenys_via_finished_at_in_vsa feature flag is off' do + before do + stub_feature_flags(query_deploymenys_via_finished_at_in_vsa: true) + end + + it 'returns the number of deployments made on that day' do + freeze_time do + create(:deployment, :success, project: project, finished_at: Time.zone.now) + options[:from] = Time.zone.now.at_beginning_of_day + options[:to] = Time.zone.now.at_end_of_day - expect(subject).to eq('1') + expect(subject).to eq('1') + end end end end |