Commit 3ccdb2b7 authored by Nick Thomas's avatar Nick Thomas

Fix conflicts in MergeRequest model by moving to EE-only module

parent 593112b7
module EE module EE
module MergeRequest module MergeRequest
extend ActiveSupport::Concern
include ::Approvable include ::Approvable
included do
has_many :approvals, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
has_many :approvers, as: :target, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
has_many :approver_groups, as: :target, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
end
def ff_merge_possible? def ff_merge_possible?
project.repository.is_ancestor?(target_branch_sha, diff_head_sha) project.repository.is_ancestor?(target_branch_sha, diff_head_sha)
end end
......
...@@ -15,12 +15,6 @@ class MergeRequest < ActiveRecord::Base ...@@ -15,12 +15,6 @@ class MergeRequest < ActiveRecord::Base
belongs_to :source_project, class_name: "Project" belongs_to :source_project, class_name: "Project"
belongs_to :merge_user, class_name: "User" belongs_to :merge_user, class_name: "User"
<<<<<<< HEAD
has_many :approvals, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
has_many :approvers, as: :target, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
has_many :approver_groups, as: :target, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
=======
>>>>>>> ce/master
has_many :merge_request_diffs has_many :merge_request_diffs
has_one :merge_request_diff, has_one :merge_request_diff,
-> { order('merge_request_diffs.id DESC') } -> { order('merge_request_diffs.id DESC') }
......
...@@ -5,6 +5,12 @@ describe MergeRequest, models: true do ...@@ -5,6 +5,12 @@ describe MergeRequest, models: true do
subject(:merge_request) { create(:merge_request, source_project: project, target_project: project) } subject(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
describe 'associations' do
it { is_expected.to have_many(:approvals).dependent(:delete_all) }
it { is_expected.to have_many(:approvers).dependent(:delete_all) }
it { is_expected.to have_many(:approver_groups).dependent(:delete_all) }
end
describe '#should_be_rebased?' do describe '#should_be_rebased?' do
subject { merge_request.should_be_rebased? } subject { merge_request.should_be_rebased? }
......
...@@ -11,10 +11,6 @@ describe MergeRequest, models: true do ...@@ -11,10 +11,6 @@ describe MergeRequest, models: true do
it { is_expected.to belong_to(:merge_user).class_name("User") } it { is_expected.to belong_to(:merge_user).class_name("User") }
it { is_expected.to belong_to(:assignee) } it { is_expected.to belong_to(:assignee) }
it { is_expected.to have_many(:merge_request_diffs) } it { is_expected.to have_many(:merge_request_diffs) }
<<<<<<< HEAD
it { is_expected.to have_many(:approver_groups).dependent(:delete_all) }
=======
>>>>>>> ce/master
end end
describe 'modules' do describe 'modules' do
......
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