Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-04-26 18:03:48 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-05-14 00:49:27 +0300
commit3b50867550818413eed01fcbe85e5442707150be (patch)
treec54edc2d17460f87a5aee530ae1e0efc182dfe29 /lib/gitlab
parent9b4dc552cb51faee38baffa6f29954d795282658 (diff)
Fix spec for Gitlab::GithubImport::PullRequestFormatter
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/github_import/importer.rb2
-rw-r--r--lib/gitlab/github_import/pull_request_formatter.rb10
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb
index bc25fc8c0b4..9aea947a812 100644
--- a/lib/gitlab/github_import/importer.rb
+++ b/lib/gitlab/github_import/importer.rb
@@ -73,7 +73,7 @@ module Gitlab
def import_pull_requests
pull_requests = client.pull_requests(repo, state: :all, sort: :created, direction: :asc)
.map { |raw| PullRequestFormatter.new(project, raw) }
- .reject(&:cross_project?)
+ .select(&:valid?)
source_branches_removed = pull_requests.reject(&:source_branch_exists?).map { |pr| [pr.source_branch, pr.source_sha] }
target_branches_removed = pull_requests.reject(&:target_branch_exists?).map { |pr| [pr.target_branch, pr.target_sha] }
diff --git a/lib/gitlab/github_import/pull_request_formatter.rb b/lib/gitlab/github_import/pull_request_formatter.rb
index ef32a23b045..f242596bdf5 100644
--- a/lib/gitlab/github_import/pull_request_formatter.rb
+++ b/lib/gitlab/github_import/pull_request_formatter.rb
@@ -24,11 +24,7 @@ module Gitlab
end
def valid?
- !cross_project? && source_branch.present? && target_branch.present?
- end
-
- def cross_project?
- source_repo.present? && target_repo.present? && source_repo.id != target_repo.id
+ !cross_project?
end
def source_branch_exists?
@@ -79,6 +75,10 @@ module Gitlab
raw_data.body || ""
end
+ def cross_project?
+ source_repo.present? && target_repo.present? && source_repo.id != target_repo.id
+ end
+
def description
formatter.author_line(author) + body
end