Commit 6c7980a7 authored by Furkan Ayhan's avatar Furkan Ayhan

Merge branch 'ci-remove-wrong-ar-association' into 'master'

Remove conflicting ActiveRecord association

See merge request gitlab-org/gitlab!79428
parents 8238206e 9e5f825f
...@@ -98,8 +98,6 @@ module EE ...@@ -98,8 +98,6 @@ module EE
has_many :downstream_project_subscriptions, class_name: 'Ci::Subscriptions::Project', foreign_key: :upstream_project_id, inverse_of: :upstream_project has_many :downstream_project_subscriptions, class_name: 'Ci::Subscriptions::Project', foreign_key: :upstream_project_id, inverse_of: :upstream_project
has_many :downstream_projects, class_name: 'Project', through: :downstream_project_subscriptions, source: :downstream_project, disable_joins: true has_many :downstream_projects, class_name: 'Project', through: :downstream_project_subscriptions, source: :downstream_project, disable_joins: true
has_many :sourced_pipelines, class_name: 'Ci::Sources::Project', foreign_key: :source_project_id
has_many :incident_management_oncall_schedules, class_name: 'IncidentManagement::OncallSchedule', inverse_of: :project has_many :incident_management_oncall_schedules, class_name: 'IncidentManagement::OncallSchedule', inverse_of: :project
has_many :incident_management_oncall_rotations, class_name: 'IncidentManagement::OncallRotation', through: :incident_management_oncall_schedules, source: :rotations has_many :incident_management_oncall_rotations, class_name: 'IncidentManagement::OncallRotation', through: :incident_management_oncall_schedules, source: :rotations
has_many :incident_management_escalation_policies, class_name: 'IncidentManagement::EscalationPolicy', inverse_of: :project has_many :incident_management_escalation_policies, class_name: 'IncidentManagement::EscalationPolicy', inverse_of: :project
......
...@@ -14,17 +14,21 @@ RSpec.describe Ci::TriggerDownstreamSubscriptionService do ...@@ -14,17 +14,21 @@ RSpec.describe Ci::TriggerDownstreamSubscriptionService do
end end
context 'when pipeline project has downstream projects' do context 'when pipeline project has downstream projects' do
let(:downstream_project) { create(:project, :repository, upstream_projects: [upstream_project]) }
before do before do
downstream_project = create(:project, :repository, upstream_projects: [upstream_project])
downstream_project.add_developer(pipeline.user) downstream_project.add_developer(pipeline.user)
end end
it 'creates a pipeline' do
expect { execute }.to change { ::Ci::Pipeline.count }.from(1).to(2)
end
it 'associates the downstream pipeline with the upstream project' do it 'associates the downstream pipeline with the upstream project' do
expect { execute }.to change { pipeline.project.sourced_pipelines.count }.from(0).to(1) expect { execute }
.to change { Ci::Sources::Project.count }.from(0).to(1)
.and change { Ci::Pipeline.count }.from(1).to(2)
project_source = Ci::Sources::Project.last
new_pipeline = Ci::Pipeline.last
expect(project_source.pipeline).to eq(new_pipeline)
expect(project_source.source_project_id).to eq(pipeline.project_id)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment