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
Tatuya Kamada
gitlab-ce
Commits
ebaa19c1
Commit
ebaa19c1
authored
May 10, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix validation method for Gitlab::GithubImport::PullRequestFormatter
parent
795a7ca8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
5 deletions
+22
-5
lib/gitlab/github_import/branch_formatter.rb
lib/gitlab/github_import/branch_formatter.rb
+4
-0
lib/gitlab/github_import/pull_request_formatter.rb
lib/gitlab/github_import/pull_request_formatter.rb
+2
-3
spec/lib/gitlab/github_import/branch_formatter_spec.rb
spec/lib/gitlab/github_import/branch_formatter_spec.rb
+14
-0
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
+2
-2
No files found.
lib/gitlab/github_import/branch_formatter.rb
View file @
ebaa19c1
...
...
@@ -15,6 +15,10 @@ module Gitlab
repo
.
present?
end
def
valid?
repo
.
present?
end
private
def
short_id
...
...
lib/gitlab/github_import/pull_request_formatter.rb
View file @
ebaa19c1
...
...
@@ -29,7 +29,7 @@ module Gitlab
end
def
valid?
!
cross_project?
source_branch
.
valid?
&&
target_branch
.
valid?
&&
!
cross_project?
end
def
source_branch
...
...
@@ -65,8 +65,7 @@ module Gitlab
end
def
cross_project?
source_branch_repo
.
present?
&&
target_branch_repo
.
present?
&&
source_branch_repo
.
id
!=
target_branch_repo
.
id
source_branch_repo
.
id
!=
target_branch_repo
.
id
end
def
description
...
...
spec/lib/gitlab/github_import/branch_formatter_spec.rb
View file @
ebaa19c1
...
...
@@ -54,4 +54,18 @@ describe Gitlab::GithubImport::BranchFormatter, lib: true do
expect
(
branch
.
sha
).
to
eq
'2e5d3239642f9161dcbbc4b70a211a68e5e45e2b'
end
end
describe
'#valid?'
do
it
'returns true when repository exists'
do
branch
=
described_class
.
new
(
project
,
double
(
raw
))
expect
(
branch
.
valid?
).
to
eq
true
end
it
'returns false when repository does not exist'
do
branch
=
described_class
.
new
(
project
,
double
(
raw
.
merge
(
repo:
nil
)))
expect
(
branch
.
valid?
).
to
eq
false
end
end
end
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
View file @
ebaa19c1
...
...
@@ -173,7 +173,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
end
context
'when source repo is a fork'
do
let
(
:source_repo
)
{
double
(
id:
2
,
fork:
true
)
}
let
(
:source_repo
)
{
double
(
id:
2
)
}
let
(
:raw_data
)
{
double
(
base_data
)
}
it
'returns false'
do
...
...
@@ -182,7 +182,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
end
context
'when target repo is a fork'
do
let
(
:target_repo
)
{
double
(
id:
2
,
fork:
true
)
}
let
(
:target_repo
)
{
double
(
id:
2
)
}
let
(
:raw_data
)
{
double
(
base_data
)
}
it
'returns false'
do
...
...
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