2020-08-20 20:10:44 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe IssueLinks::DestroyService do
|
|
|
|
describe '#execute' do
|
2022-03-04 13:20:01 -05:00
|
|
|
let_it_be(:project) { create(:project_empty_repo, :private) }
|
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:issue_a) { create(:issue, project: project) }
|
|
|
|
let_it_be(:issue_b) { create(:issue, project: project) }
|
2020-08-20 20:10:44 -04:00
|
|
|
|
2022-03-04 13:20:01 -05:00
|
|
|
let!(:issuable_link) { create(:issue_link, source: issue_a, target: issue_b) }
|
2020-08-20 20:10:44 -04:00
|
|
|
|
2022-03-04 13:20:01 -05:00
|
|
|
subject { described_class.new(issuable_link, user).execute }
|
2020-08-20 20:10:44 -04:00
|
|
|
|
2022-03-04 13:20:01 -05:00
|
|
|
it_behaves_like 'a destroyable issuable link'
|
2020-08-20 20:10:44 -04:00
|
|
|
|
2022-03-04 13:20:01 -05:00
|
|
|
context 'when target is an incident' do
|
2020-08-20 20:10:44 -04:00
|
|
|
before do
|
|
|
|
project.add_reporter(user)
|
|
|
|
end
|
|
|
|
|
2022-03-04 13:20:01 -05:00
|
|
|
let(:issue_b) { create(:incident, project: project) }
|
2020-08-20 20:10:44 -04:00
|
|
|
|
2022-03-04 13:20:01 -05:00
|
|
|
it_behaves_like 'an incident management tracked event', :incident_management_incident_unrelate do
|
|
|
|
let(:current_user) { user }
|
2020-08-20 20:10:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|