BigW Consortium Gitlab

Commit 51fbb9bf by Nick Thomas Committed by blackst0ne

Rename forked_source_project_missing? to source_project_missing?

parent f118d2fc
......@@ -326,17 +326,17 @@ class MergeRequest < ActiveRecord::Base
def validate_fork
return true unless target_project && source_project
return true if target_project == source_project
return true unless forked_source_project_missing?
return true unless source_project_missing?
errors.add :validate_fork,
'Source project is not a fork of the target project'
end
def closed_without_fork?
closed? && forked_source_project_missing?
closed? && source_project_missing?
end
def forked_source_project_missing?
def source_project_missing?
return false unless for_fork?
return true unless source_project
......
......@@ -1198,7 +1198,7 @@ describe MergeRequest, models: true do
end
end
describe "#forked_source_project_missing?" do
describe "#source_project_missing?" do
let(:project) { create(:project) }
let(:fork_project) { create(:project, forked_from_project: project) }
let(:user) { create(:user) }
......@@ -1211,13 +1211,13 @@ describe MergeRequest, models: true do
target_project: project)
end
it { expect(merge_request.forked_source_project_missing?).to be_falsey }
it { expect(merge_request.source_project_missing?).to be_falsey }
end
context "when the source project is the same as the target project" do
let(:merge_request) { create(:merge_request, source_project: project) }
it { expect(merge_request.forked_source_project_missing?).to be_falsey }
it { expect(merge_request.source_project_missing?).to be_falsey }
end
context "when the fork does not exist" do
......@@ -1231,7 +1231,7 @@ describe MergeRequest, models: true do
unlink_project.execute
merge_request.reload
expect(merge_request.forked_source_project_missing?).to be_truthy
expect(merge_request.source_project_missing?).to be_truthy
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