Commit 61536ed2 authored by Nick Thomas's avatar Nick Thomas

Rename forked_source_project_missing? to source_project_missing?

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