spec/omniauth/strategies/untappd_spec.rb in omniauth-untappd-0.1.0 vs spec/omniauth/strategies/untappd_spec.rb in omniauth-untappd-0.1.1
- old
+ new
@@ -1,10 +1,13 @@
require 'spec_helper'
describe OmniAuth::Strategies::Untappd do
subject(:strategy) { OmniAuth::Strategies::Untappd.new('client_id', 'client_secret') }
+ before { OmniAuth.config.test_mode = true }
+ after { OmniAuth.config.test_mode = false }
+
let(:parsed_response) {{ 'response' => {
'user' => {
'id' => '123',
'first_name' => 'John',
'last_name' => 'Doe',
@@ -34,20 +37,36 @@
context 'token_params' do
subject { options.token_params }
its(:parse) { should eql :json }
end
+ end
+ describe 'add redirect_url to params' do
+ let(:callback_url) { 'callback_url' }
+ before { expect(strategy).to receive(:callback_url).and_return(callback_url) }
+
+ context '#token_params' do
+ subject { strategy.token_params }
+
+ its(:redirect_url) { should eql callback_url }
+ end
+
+ context '#authorize_params' do
+ subject { strategy.authorize_params }
+
+ its(:redirect_url) { should eql callback_url }
+ end
end
context '#raw_info' do
subject { strategy.raw_info }
let(:access_token) { double('AccessToken', options: {}) }
let(:response) { double('Response', parsed: parsed_response) }
let(:user_info_url) { 'http://api.untappd.com/v4/user/info' }
before { strategy.stub(access_token: access_token) }
- before { access_token.should_receive(:get).with(user_info_url).and_return(response) }
+ before { expect(access_token).to receive(:get).with(user_info_url).and_return(response) }
it { should eql(parsed_response['response']['user']) }
context '#uid' do
subject { strategy.uid }