Change method name

This commit is contained in:
Katarzyna Kobierska 2016-08-30 13:31:39 +02:00
parent 7226631102
commit 2d8d94a788
3 changed files with 8 additions and 14 deletions

View file

@ -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) - 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 - Adds response mime type to transaction metric action when it's not HTML
- Fix hover leading space bug in pipeline graph !5980 - 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) v 8.11.3 (unreleased)
- Allow system info page to handle case where info is unavailable - 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 - Show "Create Merge Request" widget for push events to fork projects on the source project. !5978
- Use gitlab-workhorse 0.7.11 !5983 - Use gitlab-workhorse 0.7.11 !5983
- Does not halt the GitHub import process when an error occurs. !5763 - 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 - Fix file links on project page when default view is Files !5933
- Fixed enter key in search input not working !5888 - Fixed enter key in search input not working !5888

View file

@ -306,17 +306,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 fork_missing? return true unless forked_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? && fork_missing? closed? && forked_source_project_missing?
end end
def fork_missing? def forked_source_project_missing?
return false unless for_fork? return false unless for_fork?
return true unless source_project return true unless source_project

View file

@ -963,7 +963,7 @@ describe MergeRequest, models: true do
end end
end end
describe "#fork_missing?" do describe "#forked_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) }
@ -976,13 +976,13 @@ describe MergeRequest, models: true do
target_project: project) target_project: project)
end end
it { expect(merge_request.fork_missing?).to be_falsey } it { expect(merge_request.forked_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.fork_missing?).to be_falsey } it { expect(merge_request.forked_source_project_missing?).to be_falsey }
end end
context "when the fork does not exist" do context "when the fork does not exist" do
@ -996,7 +996,7 @@ describe MergeRequest, models: true do
unlink_project.execute unlink_project.execute
merge_request.reload merge_request.reload
expect(merge_request.fork_missing?).to be_truthy expect(merge_request.forked_source_project_missing?).to be_truthy
end end
end end
end end