Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb')
-rw-r--r--spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb34
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