Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
61536ed2
Commit
61536ed2
authored
Oct 19, 2016
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename forked_source_project_missing? to source_project_missing?
parent
6f846fcb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
app/models/merge_request.rb
app/models/merge_request.rb
+3
-3
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+4
-4
No files found.
app/models/merge_request.rb
View file @
61536ed2
...
@@ -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
...
...
spec/models/merge_request_spec.rb
View file @
61536ed2
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment