Fix Rubocop errors with Bitbucket Importer spec

This commit is contained in:
Stan Hu 2016-11-21 20:58:46 -08:00
parent 402cc95c1a
commit fc40c3f28a

View file

@ -67,14 +67,14 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
:get, :get,
"https://api.bitbucket.org/2.0/repositories/#{project_identifier}" "https://api.bitbucket.org/2.0/repositories/#{project_identifier}"
).to_return(status: 200, ).to_return(status: 200,
headers: {"Content-Type" => "application/json"}, headers: { "Content-Type" => "application/json" },
body: { has_issues: true, full_name: project_identifier }.to_json) body: { has_issues: true, full_name: project_identifier }.to_json)
stub_request( stub_request(
:get, :get,
"https://api.bitbucket.org/2.0/repositories/#{project_identifier}/issues?pagelen=50&sort=created_on" "https://api.bitbucket.org/2.0/repositories/#{project_identifier}/issues?pagelen=50&sort=created_on"
).to_return(status: 200, ).to_return(status: 200,
headers: {"Content-Type" => "application/json"}, headers: { "Content-Type" => "application/json" },
body: issues_statuses_sample_data.to_json) body: issues_statuses_sample_data.to_json)
sample_issues_statuses.each_with_index do |issue, index| sample_issues_statuses.each_with_index do |issue, index|
@ -83,7 +83,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
"https://api.bitbucket.org/2.0/repositories/#{project_identifier}/issues/#{issue[:id]}/comments?pagelen=50&sort=created_on" "https://api.bitbucket.org/2.0/repositories/#{project_identifier}/issues/#{issue[:id]}/comments?pagelen=50&sort=created_on"
).to_return( ).to_return(
status: 200, status: 200,
headers: {"Content-Type" => "application/json"}, headers: { "Content-Type" => "application/json" },
body: { author_info: { username: "username" }, utc_created_on: index }.to_json body: { author_info: { username: "username" }, utc_created_on: index }.to_json
) )
end end
@ -92,13 +92,13 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
:get, :get,
"https://api.bitbucket.org/2.0/repositories/#{project_identifier}/pullrequests?pagelen=50&sort=created_on&state=ALL" "https://api.bitbucket.org/2.0/repositories/#{project_identifier}/pullrequests?pagelen=50&sort=created_on&state=ALL"
).to_return(status: 200, ).to_return(status: 200,
headers: {"Content-Type" => "application/json"}, headers: { "Content-Type" => "application/json" },
body: {}.to_json) body: {}.to_json)
end end
it 'map statuses to open or closed' do 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 Bitbucket::Representation::Issue.new
importer.execute importer.execute
expect(project.issues.where(state: "closed").size).to eq(5) expect(project.issues.where(state: "closed").size).to eq(5)