Commit c756e62b authored by Valery Sizov's avatar Valery Sizov

BB importer: fix specs

parent 6bbe2f11
require 'spec_helper'
describe Bitbucket::Connection do
before do
allow_any_instance_of(described_class).to receive(:provider).and_return(double(app_id: '', app_secret: ''))
end
describe '#get' do
it 'calls OAuth2::AccessToken::get' do
expect_any_instance_of(OAuth2::AccessToken).to receive(:get).and_return(double(parsed: true))
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Bitbucket::Representation::Comment do
describe '#author' do
it { expect(described_class.new('user' => { 'username' => 'Ben' }).author).to eq('Ben') }
it { expect(described_class.new({}).author).to eq('Anonymous') }
it { expect(described_class.new({}).author).to be_nil }
end
describe '#note' do
......
......@@ -10,12 +10,12 @@ describe Bitbucket::Representation::Issue do
end
describe '#author' do
it { expect(described_class.new({ 'reporter' => { 'username' => 'Ben' }}).author).to eq('Ben') }
it { expect(described_class.new({}).author).to eq('Anonymous') }
it { expect(described_class.new({ 'reporter' => { 'username' => 'Ben' } }).author).to eq('Ben') }
it { expect(described_class.new({}).author).to be_nil }
end
describe '#description' do
it { expect(described_class.new({ 'content' => { 'raw' => 'Text' }}).description).to eq('Text') }
it { expect(described_class.new({ 'content' => { 'raw' => 'Text' } }).description).to eq('Text') }
it { expect(described_class.new({}).description).to be_nil }
end
......
......@@ -17,9 +17,8 @@ describe Bitbucket::Representation::PullRequestComment do
it { expect(described_class.new('inline' => { 'to' => 3 }).new_pos).to eq(3) }
end
describe '#parent_id' do
it { expect(described_class.new({ 'parent' => { 'id' => 2 }}).parent_id).to eq(2) }
it { expect(described_class.new({ 'parent' => { 'id' => 2 } }).parent_id).to eq(2) }
it { expect(described_class.new({}).parent_id).to be_nil }
end
......
......@@ -6,8 +6,8 @@ describe Bitbucket::Representation::PullRequest do
end
describe '#author' do
it { expect(described_class.new({ 'author' => { 'username' => 'Ben' }}).author).to eq('Ben') }
it { expect(described_class.new({}).author).to eq('Anonymous') }
it { expect(described_class.new({ 'author' => { 'username' => 'Ben' } }).author).to eq('Ben') }
it { expect(described_class.new({}).author).to be_nil }
end
describe '#description' do
......
......@@ -84,10 +84,10 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
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 => {})
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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment