diff options
author | Paul Charlton <techguru@byiq.com> | 2017-07-11 09:23:51 +0300 |
---|---|---|
committer | Paul Charlton <techguru@byiq.com> | 2017-07-11 09:23:51 +0300 |
commit | 65eca13f7b6a93b54267f82e4c66a5f9bab69dc1 (patch) | |
tree | 109f3170ff776407d5e947c2e8ebc317c62833fb /spec | |
parent | 0b434daf52cb93ea42cb49ce15aa59dd01599181 (diff) |
Repair Regression caused by - !11573
some changes introduced by 4daa6da5407d235cbe4f7a787eaa29304446a870, 26b6e299e1c97b956306572c5c9f6c02f428bfd7, 17898ce021fc365c620d4600df68c3e7d2151619 were regressed during today's merge conflict resolution of !11573.
This commit serves to reapply those changes.
/cc: @rspeicher @stanhu @mikegreiling
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/milestones/destroy_service_spec.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/services/milestones/destroy_service_spec.rb b/spec/services/milestones/destroy_service_spec.rb new file mode 100644 index 00000000000..8d1fe3ae2c1 --- /dev/null +++ b/spec/services/milestones/destroy_service_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +describe Milestones::DestroyService, services: true do + let(:user) { create(:user) } + let(:project) { create(:project) } + let(:milestone) { create(:milestone, title: 'Milestone v1.0', project: project) } + let(:issue) { create(:issue, project: project, milestone: milestone) } + let(:merge_request) { create(:merge_request, source_project: project, milestone: milestone) } + + before do + project.team << [user, :master] + end + + def service + described_class.new(project, user, {}) + end + + describe '#execute' do + it 'deletes milestone' do + service.execute(milestone) + + expect { milestone.reload }.to raise_error ActiveRecord::RecordNotFound + end + + it 'deletes milestone id from issuables' do + service.execute(milestone) + + expect(issue.reload.milestone).to be_nil + expect(merge_request.reload.milestone).to be_nil + end + + context 'group milestones' do + let(:group) { create(:group) } + let(:group_milestone) { create(:milestone, group: group) } + + before do + project.update(namespace: group) + group.add_developer(user) + end + + it { expect(service.execute(group_milestone)).to be_nil } + + it 'does not update milestone issuables' do + expect(MergeRequests::UpdateService).not_to receive(:new) + expect(Issues::UpdateService).not_to receive(:new) + + service.execute(group_milestone) + end + end + end +end |