Commit 2d8d94a7 authored by Katarzyna Kobierska's avatar Katarzyna Kobierska

Change method name

parent 72266311
......@@ -40,6 +40,7 @@ v 8.12.0 (unreleased)
- Use the default branch for displaying the project icon instead of master !5792 (Hannes Rosenögger)
- Adds response mime type to transaction metric action when it's not HTML
- Fix hover leading space bug in pipeline graph !5980
- User can edit closed MR with deleted fork (Katarzyna Kobierska Ula Budziszewska) !5496
v 8.11.3 (unreleased)
- Allow system info page to handle case where info is unavailable
......@@ -53,13 +54,6 @@ v 8.11.2
- Show "Create Merge Request" widget for push events to fork projects on the source project. !5978
- Use gitlab-workhorse 0.7.11 !5983
- Does not halt the GitHub import process when an error occurs. !5763
- User can edit closed MR with deleted fork (Katarzyna Kobierska Ula Budziszewska) !5496
v 8.11.2 (unreleased)
- Show "Create Merge Request" widget for push events to fork projects on the source project
v 8.11.1 (unreleased)
- Does not halt the GitHub import process when an error occurs
- Fix file links on project page when default view is Files !5933
- Fixed enter key in search input not working !5888
......
......@@ -306,17 +306,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 fork_missing?
return true unless forked_source_project_missing?
errors.add :validate_fork,
'Source project is not a fork of the target project'
end
def closed_without_fork?
closed? && fork_missing?
closed? && forked_source_project_missing?
end
def fork_missing?
def forked_source_project_missing?
return false unless for_fork?
return true unless source_project
......
......@@ -963,7 +963,7 @@ describe MergeRequest, models: true do
end
end
describe "#fork_missing?" do
describe "#forked_source_project_missing?" do
let(:project) { create(:project) }
let(:fork_project) { create(:project, forked_from_project: project) }
let(:user) { create(:user) }
......@@ -976,13 +976,13 @@ describe MergeRequest, models: true do
target_project: project)
end
it { expect(merge_request.fork_missing?).to be_falsey }
it { expect(merge_request.forked_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.fork_missing?).to be_falsey }
it { expect(merge_request.forked_source_project_missing?).to be_falsey }
end
context "when the fork does not exist" do
......@@ -996,7 +996,7 @@ describe MergeRequest, models: true do
unlink_project.execute
merge_request.reload
expect(merge_request.fork_missing?).to be_truthy
expect(merge_request.forked_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