-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from intercom/faraday
Fix compatibility with Faraday 2.0
- Loading branch information
Showing
3 changed files
with
13 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
require 'spec_helper' | ||
|
||
describe OmniAuth::Strategies::Intercom do | ||
let(:access_token) { double('AccessToken', options: {}) } | ||
let(:access_token) { instance_double(OAuth2::AccessToken) } | ||
let(:token) { 'some-token' } | ||
let(:client) { double('Client') } | ||
let(:connection) { double('Connection') } | ||
let(:client) { instance_double(OAuth2::Client) } | ||
let(:connection) { instance_double(Faraday::Connection) } | ||
let(:headers) { {} } | ||
let(:options) { {} } | ||
|
||
|
@@ -21,12 +21,11 @@ | |
|
||
allow(client).to receive(:connection).and_return connection | ||
allow(connection).to receive(:headers).and_return headers | ||
allow(connection).to receive(:basic_auth).and_return "Bearer #{token}" | ||
end | ||
|
||
context 'with verified email' do | ||
let(:parsed_response) { JSON.parse({email: '[email protected]', name: 'Kevin Antoine', avatar: {image_url: 'https://static.intercomassets.com/avatars/343616/square_128/me.jpg?1454165491'}, email_verified: true}.to_json) } | ||
let(:response) { double('Response', :parsed => parsed_response) } | ||
let(:response) { instance_double(OAuth2::Response, :parsed => parsed_response) } | ||
|
||
before do | ||
allow(access_token).to receive(:get).with('/me').and_return response | ||
|
@@ -103,7 +102,7 @@ | |
|
||
context 'with unverified email' do | ||
let(:parsed_response) { JSON.parse({email: '[email protected]', name: 'Kevin Antoine', avatar: {image_url: 'https://static.intercomassets.com/avatars/343616/square_128/me.jpg?1454165491'}, email_verified: false}.to_json) } | ||
let(:response) { double('Response', :parsed => parsed_response) } | ||
let(:response) { instance_double(OAuth2::Response, :parsed => parsed_response) } | ||
|
||
before do | ||
allow(access_token).to receive(:get).with('/me').and_return response | ||
|