summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-08-03 18:50:52 +0100
committerSean McGivern <sean@gitlab.com>2017-08-07 11:55:01 +0100
commit76b80d6e96bd003de7d46736eb7b6d2de98df1a1 (patch)
treea1dfc0d2e80058829d533f0645f74014cea59518 /spec
parentca923d48998294d0903d47aa613862a873341bf1 (diff)
downloadgitlab-ce-76b80d6e96bd003de7d46736eb7b6d2de98df1a1.tar.gz
Show group milestones in autocomplete
Diffstat (limited to 'spec')
-rw-r--r--spec/services/projects/autocomplete_service_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/services/projects/autocomplete_service_spec.rb b/spec/services/projects/autocomplete_service_spec.rb
index c1f098530bf..426593be428 100644
--- a/spec/services/projects/autocomplete_service_spec.rb
+++ b/spec/services/projects/autocomplete_service_spec.rb
@@ -88,4 +88,31 @@ describe Projects::AutocompleteService do
end
end
end
+
+ describe '#milestones' do
+ let(:user) { create(:user) }
+ let(:group) { create(:group) }
+ let(:project) { create(:project, group: group) }
+ let!(:group_milestone) { create(:milestone, group: group) }
+ let!(:project_milestone) { create(:milestone, project: project) }
+
+ let(:milestone_titles) { described_class.new(project, user).milestones.map(&:title) }
+
+ it 'includes project and group milestones' do
+ expect(milestone_titles).to eq([group_milestone.title, project_milestone.title])
+ end
+
+ it 'does not include closed milestones' do
+ group_milestone.close
+
+ expect(milestone_titles).to eq([project_milestone.title])
+ end
+
+ it 'does not include milestones from other projects in the group' do
+ other_project = create(:project, group: group)
+ project_milestone.update!(project: other_project)
+
+ expect(milestone_titles).to eq([group_milestone.title])
+ end
+ end
end