diff options
author | Fatih Acet <acetfatih@gmail.com> | 2018-12-20 12:14:33 +0100 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2018-12-20 13:33:09 +0100 |
commit | e9ef02096be859e31c155174fe2784d8a7ba73e3 (patch) | |
tree | c839c271e35cd1474801ff20d90bf9be3a2135bf /spec/models/group_milestone_spec.rb | |
parent | f7ac8041f7ba3639085c26b4185eda00fd54a6e7 (diff) | |
download | gitlab-ce-e9ef02096be859e31c155174fe2784d8a7ba73e3.tar.gz |
Add project milestone link to dashboard milestonesccr/49289_milestone_link
One of the steps to deprecate dashboard milestones.
Links do dashboard milestone are replaced with links for each
project milestone
Diffstat (limited to 'spec/models/group_milestone_spec.rb')
-rw-r--r-- | spec/models/group_milestone_spec.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/spec/models/group_milestone_spec.rb b/spec/models/group_milestone_spec.rb index b60676afc91..fcc33cd95fe 100644 --- a/spec/models/group_milestone_spec.rb +++ b/spec/models/group_milestone_spec.rb @@ -20,13 +20,36 @@ describe GroupMilestone do end describe '.build_collection' do - before do - project_milestone + let(:group) { create(:group) } + let(:project1) { create(:project, group: group) } + let(:project2) { create(:project, path: 'gitlab-ci', group: group) } + let(:project3) { create(:project, path: 'cookbook-gitlab', group: group) } + + let!(:projects) do + [ + project1, + project2, + project3 + ] end it 'returns array of milestones, each with group assigned' do milestones = described_class.build_collection(group, [project], {}) expect(milestones).to all(have_attributes(group: group)) end + + context 'when adding new milestones' do + it 'does not add more queries' do + control_count = ActiveRecord::QueryRecorder.new do + described_class.build_collection(group, projects, {}) + end.count + + create(:milestone, title: 'This title', project: project1) + + expect do + described_class.build_collection(group, projects, {}) + end.not_to exceed_all_query_limit(control_count) + end + end end end |