diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2019-03-04 18:37:15 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-03-04 18:37:15 +0000 |
commit | 025015048f7eaad29ee7816c6040fb3e0c06eb8d (patch) | |
tree | 50d713b293ffd0dee44b715dd9c12621810f8fa5 /spec/services/merge_requests | |
parent | 6683298fe6d85bb0785906723663482798418907 (diff) | |
parent | 30ab6ee416783cd9481085f021603383eeb4f317 (diff) | |
download | gitlab-ce-025015048f7eaad29ee7816c6040fb3e0c06eb8d.tar.gz |
Merge branch 'security-2773-milestones-fix' into 'master'
[master] Check issue milestone availability
See merge request gitlab/gitlabhq!2788
Diffstat (limited to 'spec/services/merge_requests')
-rw-r--r-- | spec/services/merge_requests/build_service_spec.rb | 9 | ||||
-rw-r--r-- | spec/services/merge_requests/update_service_spec.rb | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/spec/services/merge_requests/build_service_spec.rb b/spec/services/merge_requests/build_service_spec.rb index 536d0d345a4..057e8137a4e 100644 --- a/spec/services/merge_requests/build_service_spec.rb +++ b/spec/services/merge_requests/build_service_spec.rb @@ -229,6 +229,15 @@ describe MergeRequests::BuildService do end end end + + context 'when a milestone is from another project' do + let(:milestone) { create(:milestone, project: create(:project)) } + let(:milestone_id) { milestone.id } + + it 'sets milestone to nil' do + expect(merge_request.milestone).to be_nil + end + end end end diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb index 20580bf14b9..8e367db031c 100644 --- a/spec/services/merge_requests/update_service_spec.rb +++ b/spec/services/merge_requests/update_service_spec.rb @@ -328,7 +328,7 @@ describe MergeRequests::UpdateService, :mailer do it_behaves_like 'system notes for milestones' it 'sends notifications for subscribers of changed milestone' do - merge_request.milestone = create(:milestone) + merge_request.milestone = create(:milestone, project: project) merge_request.save @@ -352,7 +352,7 @@ describe MergeRequests::UpdateService, :mailer do end it 'marks pending todos as done' do - update_merge_request({ milestone: create(:milestone) }) + update_merge_request({ milestone: create(:milestone, project: project) }) expect(pending_todo.reload).to be_done end @@ -361,7 +361,7 @@ describe MergeRequests::UpdateService, :mailer do it 'sends notifications for subscribers of changed milestone' do perform_enqueued_jobs do - update_merge_request(milestone: create(:milestone)) + update_merge_request(milestone: create(:milestone, project: project)) end should_email(subscriber) |