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:
authorValery Sizov <valery@gitlab.com>2016-12-09 20:40:22 +0300
committerValery Sizov <valery@gitlab.com>2016-12-09 20:40:22 +0300
commitff2193a3db558214fab90bb644be6967a03176a0 (patch)
tree86f07dc8988fb15f611b75154a616ee76e0d5051
parentcc30a9f7ed436fd906c1e24a195414f2f84ee61c (diff)
Fix specs
-rw-r--r--lib/gitlab/bitbucket_import/importer.rb6
-rw-r--r--spec/lib/gitlab/bitbucket_import/importer_spec.rb14
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/gitlab/bitbucket_import/importer.rb b/lib/gitlab/bitbucket_import/importer.rb
index e00a90da980..a0a17333185 100644
--- a/lib/gitlab/bitbucket_import/importer.rb
+++ b/lib/gitlab/bitbucket_import/importer.rb
@@ -58,7 +58,7 @@ module Gitlab
updated_at: issue.updated_at
)
- assign_label(issue, label_name)
+ issue.labels << @labels[label_name]
if issue.persisted?
client.issue_comments(repo, issue.iid).each do |comment|
@@ -92,10 +92,6 @@ module Gitlab
end
end
- def assign_label(issue, label_name)
- issue.labels << @labels[label_name]
- end
-
def import_pull_requests
pull_requests = client.pull_requests(repo)
diff --git a/spec/lib/gitlab/bitbucket_import/importer_spec.rb b/spec/lib/gitlab/bitbucket_import/importer_spec.rb
index ef4fc9fd08e..353312675d6 100644
--- a/spec/lib/gitlab/bitbucket_import/importer_spec.rb
+++ b/spec/lib/gitlab/bitbucket_import/importer_spec.rb
@@ -18,6 +18,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
"closed" # undocumented status
]
end
+
let(:sample_issues_statuses) do
issues = []
@@ -26,6 +27,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
id: index,
state: status,
title: "Issue #{index}",
+ kind: 'bug',
content: {
raw: "Some content to issue #{index}",
markup: "markdown",
@@ -38,6 +40,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
end
let(:project_identifier) { 'namespace/repo' }
+
let(:data) do
{
'bb_session' => {
@@ -46,6 +49,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
}
}
end
+
let(:project) do
create(
:project,
@@ -53,7 +57,9 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
import_data: ProjectImportData.new(credentials: data)
)
end
+
let(:importer) { Gitlab::BitbucketImport::Importer.new(project) }
+
let(:issues_statuses_sample_data) do
{
count: sample_issues_statuses.count,
@@ -77,6 +83,12 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
headers: { "Content-Type" => "application/json" },
body: issues_statuses_sample_data.to_json)
+ stub_request(:get, "https://api.bitbucket.org/2.0/repositories/namespace/repo?pagelen=50&sort=created_on").
+ with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer', 'User-Agent'=>'Faraday v0.9.2'}).
+ to_return(:status => 200,
+ :body => "",
+ :headers => {})
+
sample_issues_statuses.each_with_index do |issue, index|
stub_request(
:get,
@@ -97,7 +109,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
end
it 'map statuses to open or closed' do
- # HACK: Bitbucket::Representation.const_get('Issue') seems to return Issue without this
+ # HACK: Bitbucket::Representation.const_get('Issue') seems to return ::Issue without this
Bitbucket::Representation::Issue.new({})
importer.execute