summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2016-12-14 20:19:26 +0200
committerValery Sizov <valery@gitlab.com>2016-12-14 20:19:26 +0200
commitc756e62b08f0a639f5550d17339b2938c9c9e096 (patch)
treeb4c3abe28080b48a72159d611ccc37b7c8b3e6a8
parent6bbe2f118ee17ac8b1d43a77f4020c048c427b77 (diff)
downloadgitlab-ce-c756e62b08f0a639f5550d17339b2938c9c9e096.tar.gz
BB importer: fix specs
-rw-r--r--spec/lib/bitbucket/connection_spec.rb4
-rw-r--r--spec/lib/bitbucket/representation/comment_spec.rb2
-rw-r--r--spec/lib/bitbucket/representation/issue_spec.rb6
-rw-r--r--spec/lib/bitbucket/representation/pull_request_comment_spec.rb3
-rw-r--r--spec/lib/bitbucket/representation/pull_request_spec.rb4
-rw-r--r--spec/lib/gitlab/bitbucket_import/importer_spec.rb8
6 files changed, 15 insertions, 12 deletions
diff --git a/spec/lib/bitbucket/connection_spec.rb b/spec/lib/bitbucket/connection_spec.rb
index 6be681a8b47..14faeb231a9 100644
--- a/spec/lib/bitbucket/connection_spec.rb
+++ b/spec/lib/bitbucket/connection_spec.rb
@@ -1,6 +1,10 @@
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))
diff --git a/spec/lib/bitbucket/representation/comment_spec.rb b/spec/lib/bitbucket/representation/comment_spec.rb
index 5864193cbfc..fec243a9f96 100644
--- a/spec/lib/bitbucket/representation/comment_spec.rb
+++ b/spec/lib/bitbucket/representation/comment_spec.rb
@@ -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
diff --git a/spec/lib/bitbucket/representation/issue_spec.rb b/spec/lib/bitbucket/representation/issue_spec.rb
index 56deae63bbc..e1f3419c77e 100644
--- a/spec/lib/bitbucket/representation/issue_spec.rb
+++ b/spec/lib/bitbucket/representation/issue_spec.rb
@@ -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
diff --git a/spec/lib/bitbucket/representation/pull_request_comment_spec.rb b/spec/lib/bitbucket/representation/pull_request_comment_spec.rb
index 8377f0540cd..673dcf22ce8 100644
--- a/spec/lib/bitbucket/representation/pull_request_comment_spec.rb
+++ b/spec/lib/bitbucket/representation/pull_request_comment_spec.rb
@@ -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
diff --git a/spec/lib/bitbucket/representation/pull_request_spec.rb b/spec/lib/bitbucket/representation/pull_request_spec.rb
index 661422efddf..30453528be4 100644
--- a/spec/lib/bitbucket/representation/pull_request_spec.rb
+++ b/spec/lib/bitbucket/representation/pull_request_spec.rb
@@ -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
diff --git a/spec/lib/gitlab/bitbucket_import/importer_spec.rb b/spec/lib/gitlab/bitbucket_import/importer_spec.rb
index 353312675d6..53f3c73ade4 100644
--- a/spec/lib/gitlab/bitbucket_import/importer_spec.rb
+++ b/spec/lib/gitlab/bitbucket_import/importer_spec.rb
@@ -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(