Remove deprecated rspec methods usage

This commit is contained in:
ErickSkrauch 2017-11-03 15:45:01 +03:00
parent 2c6454f457
commit d3e8eee7a5
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E

View File

@ -1,50 +1,50 @@
require 'spec_helper'
describe OmniAuth::Strategies::Ely do
let(:access_token) { stub('AccessToken', :options => {}) }
let(:parsed_response) { stub('ParsedResponse') }
let(:response) { stub('Response', :parsed => parsed_response) }
let(:access_token) { double('AccessToken', :options => {}) }
let(:parsed_response) { double('ParsedResponse') }
let(:response) { double('Response', :parsed => parsed_response) }
subject do
OmniAuth::Strategies::Ely.new({})
end
before(:each) do
subject.stub!(:access_token).and_return(access_token)
allow(subject).to receive(:access_token).and_return(access_token)
end
context 'client options' do
it 'should have correct site' do
subject.options.client_options.site.should eq('https://account.ely.by')
expect(subject.options.client_options.site).to eq('https://account.ely.by')
end
it 'should have correct authorize url' do
subject.options.client_options.authorize_url.should eq('https://account.ely.by/oauth2/v1/')
expect(subject.options.client_options.authorize_url).to eq('https://account.ely.by/oauth2/v1/')
end
it 'should have correct token url' do
subject.options.client_options.token_url.should eq('https://account.ely.by/api/oauth2/v1/token')
expect(subject.options.client_options.token_url).to eq('https://account.ely.by/api/oauth2/v1/token')
end
end
context '#raw_info' do
it 'should use relative paths' do
access_token.should_receive(:get).and_return(response)
subject.raw_info.should eq(parsed_response)
expect(access_token).to receive(:get).and_return(response)
expect(subject.raw_info).to eq(parsed_response)
end
it 'should build valid profile link' do
raw_info = Hash.new
raw_info['id'] = 1
subject.stub!(:raw_info).and_return(raw_info)
subject.profile_url.should eq('http://ely.by/u1')
allow(subject).to receive(:raw_info).and_return(raw_info)
expect(subject.profile_url).to eq('http://ely.by/u1')
end
it 'should build valid skin link' do
raw_info = Hash.new
raw_info['username'] = 'Steve'
subject.stub!(:raw_info).and_return(raw_info)
subject.skin_url.should eq('http://skinsystem.ely.by/skins/Steve.png')
allow(subject).to receive(:raw_info).and_return(raw_info)
expect(subject.skin_url).to eq('http://skinsystem.ely.by/skins/Steve.png')
end
end
end