mirror of
https://github.com/elyby/omniauth-ely.git
synced 2024-11-08 13:42:26 +05:30
Remove deprecated rspec methods usage
This commit is contained in:
parent
2c6454f457
commit
d3e8eee7a5
@ -1,50 +1,50 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe OmniAuth::Strategies::Ely do
|
describe OmniAuth::Strategies::Ely do
|
||||||
let(:access_token) { stub('AccessToken', :options => {}) }
|
let(:access_token) { double('AccessToken', :options => {}) }
|
||||||
let(:parsed_response) { stub('ParsedResponse') }
|
let(:parsed_response) { double('ParsedResponse') }
|
||||||
let(:response) { stub('Response', :parsed => parsed_response) }
|
let(:response) { double('Response', :parsed => parsed_response) }
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
OmniAuth::Strategies::Ely.new({})
|
OmniAuth::Strategies::Ely.new({})
|
||||||
end
|
end
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
subject.stub!(:access_token).and_return(access_token)
|
allow(subject).to receive(:access_token).and_return(access_token)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'client options' do
|
context 'client options' do
|
||||||
it 'should have correct site' 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
|
end
|
||||||
|
|
||||||
it 'should have correct authorize url' do
|
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
|
end
|
||||||
|
|
||||||
it 'should have correct token url' do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
context '#raw_info' do
|
context '#raw_info' do
|
||||||
it 'should use relative paths' do
|
it 'should use relative paths' do
|
||||||
access_token.should_receive(:get).and_return(response)
|
expect(access_token).to receive(:get).and_return(response)
|
||||||
subject.raw_info.should eq(parsed_response)
|
expect(subject.raw_info).to eq(parsed_response)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should build valid profile link' do
|
it 'should build valid profile link' do
|
||||||
raw_info = Hash.new
|
raw_info = Hash.new
|
||||||
raw_info['id'] = 1
|
raw_info['id'] = 1
|
||||||
subject.stub!(:raw_info).and_return(raw_info)
|
allow(subject).to receive(:raw_info).and_return(raw_info)
|
||||||
subject.profile_url.should eq('http://ely.by/u1')
|
expect(subject.profile_url).to eq('http://ely.by/u1')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should build valid skin link' do
|
it 'should build valid skin link' do
|
||||||
raw_info = Hash.new
|
raw_info = Hash.new
|
||||||
raw_info['username'] = 'Steve'
|
raw_info['username'] = 'Steve'
|
||||||
subject.stub!(:raw_info).and_return(raw_info)
|
allow(subject).to receive(:raw_info).and_return(raw_info)
|
||||||
subject.skin_url.should eq('http://skinsystem.ely.by/skins/Steve.png')
|
expect(subject.skin_url).to eq('http://skinsystem.ely.by/skins/Steve.png')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user