summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb')
-rw-r--r--spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb b/spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
index eea4f33ccb8..d5c2f7cc579 100644
--- a/spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
+++ b/spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
@@ -8,7 +8,7 @@ describe Gitlab::CycleAnalytics::GroupStageSummary do
let(:from) { 1.day.ago }
let(:user) { create(:user, :admin) }
- subject { described_class.new(group, from: Time.now, current_user: user).data }
+ subject { described_class.new(group, options: { from: Time.now, current_user: user }).data }
describe "#new_issues" do
context 'with from date' do
@@ -32,6 +32,18 @@ describe Gitlab::CycleAnalytics::GroupStageSummary do
expect(subject.first[:value]).to eq(3)
end
end
+
+ context 'with projects specified in options' do
+ before do
+ Timecop.freeze(5.days.from_now) { create(:issue, project: create(:project, namespace: group)) }
+ end
+
+ subject { described_class.new(group, options: { from: Time.now, current_user: user, projects: [project.id, project_2.id] }).data }
+
+ it 'finds issues from those projects' do
+ expect(subject.first[:value]).to eq(2)
+ end
+ end
end
context 'with other projects' do
@@ -71,6 +83,20 @@ describe Gitlab::CycleAnalytics::GroupStageSummary do
expect(subject.second[:value]).to eq(3)
end
end
+
+ context 'with projects specified in options' do
+ before do
+ Timecop.freeze(5.days.from_now) do
+ create(:deployment, :success, project: create(:project, :repository, namespace: group, name: 'not_applicable'))
+ end
+ end
+
+ subject { described_class.new(group, options: { from: Time.now, current_user: user, projects: [project.id, project_2.id] }).data }
+
+ it 'shows deploys from those projects' do
+ expect(subject.second[:value]).to eq(2)
+ end
+ end
end
context 'with other projects' do