diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-20 09:06:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-20 09:06:16 +0300 |
commit | 0282449e6ea95b54b32acfd2de24c8c5f64a8165 (patch) | |
tree | 017b43b103e45ff571d637a5efc77b5ed25c0686 /spec/lib/bitbucket | |
parent | 0ecdcf59f4342de55a7d2c3ee4ac0d9c3b116aa5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/bitbucket')
-rw-r--r-- | spec/lib/bitbucket/connection_spec.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/lib/bitbucket/connection_spec.rb b/spec/lib/bitbucket/connection_spec.rb index ec8eac232cd..5aca93767dc 100644 --- a/spec/lib/bitbucket/connection_spec.rb +++ b/spec/lib/bitbucket/connection_spec.rb @@ -4,12 +4,16 @@ 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: '')) + allow_next_instance_of(described_class) do |instance| + allow(instance).to receive(:provider).and_return(double(app_id: '', app_secret: '')) + end end describe '#get' do it 'calls OAuth2::AccessToken::get' do - expect_any_instance_of(OAuth2::AccessToken).to receive(:get).and_return(double(parsed: true)) + expect_next_instance_of(OAuth2::AccessToken) do |instance| + expect(instance).to receive(:get).and_return(double(parsed: true)) + end connection = described_class.new({}) @@ -19,7 +23,9 @@ describe Bitbucket::Connection do describe '#expired?' do it 'calls connection.expired?' do - expect_any_instance_of(OAuth2::AccessToken).to receive(:expired?).and_return(true) + expect_next_instance_of(OAuth2::AccessToken) do |instance| + expect(instance).to receive(:expired?).and_return(true) + end expect(described_class.new({}).expired?).to be_truthy end @@ -29,7 +35,9 @@ describe Bitbucket::Connection do it 'calls connection.refresh!' do response = double(token: nil, expires_at: nil, expires_in: nil, refresh_token: nil) - expect_any_instance_of(OAuth2::AccessToken).to receive(:refresh!).and_return(response) + expect_next_instance_of(OAuth2::AccessToken) do |instance| + expect(instance).to receive(:refresh!).and_return(response) + end described_class.new({}).refresh! end |