Skip to content

Commit e421860

Browse files
committed
Merge pull request #21 from loganhasson/master
Update RSpec to ~> 2.14.1 and convert specs to new syntax
2 parents 430e3d5 + a265966 commit e421860

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

omniauth-linkedin-oauth2.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ Gem::Specification.new do |gem|
2424
gem.add_development_dependency 'bundler', '~> 1.3'
2525
gem.add_development_dependency 'rake'
2626

27-
gem.add_development_dependency 'rspec', '~> 2.13.0'
27+
gem.add_development_dependency 'rspec', '~> 2.14.1'
2828
gem.add_development_dependency 'simplecov'
2929
end

spec/omniauth/strategies/linkedin_spec.rb

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,86 +5,86 @@
55
subject { OmniAuth::Strategies::LinkedIn.new(nil) }
66

77
it 'should add a camelization for itself' do
8-
OmniAuth::Utils.camelize('linkedin').should == 'LinkedIn'
8+
expect(OmniAuth::Utils.camelize('linkedin')).to eq('LinkedIn')
99
end
1010

1111
describe '#client' do
1212
it 'has correct LinkedIn site' do
13-
subject.client.site.should eq('https://api.linkedin.com')
13+
expect(subject.client.site).to eq('https://api.linkedin.com')
1414
end
1515

1616
it 'has correct authorize url' do
17-
subject.client.options[:authorize_url].should eq('https://www.linkedin.com/uas/oauth2/authorization?response_type=code')
17+
expect(subject.client.options[:authorize_url]).to eq('https://www.linkedin.com/uas/oauth2/authorization?response_type=code')
1818
end
1919

2020
it 'has correct token url' do
21-
subject.client.options[:token_url].should eq('https://www.linkedin.com/uas/oauth2/accessToken')
21+
expect(subject.client.options[:token_url]).to eq('https://www.linkedin.com/uas/oauth2/accessToken')
2222
end
2323
end
2424

2525
describe '#callback_path' do
2626
it 'has the correct callback path' do
27-
subject.callback_path.should eq('/auth/linkedin/callback')
27+
expect(subject.callback_path).to eq('/auth/linkedin/callback')
2828
end
2929
end
3030

3131
describe '#uid' do
3232
before :each do
33-
subject.stub(:raw_info) { { 'id' => 'uid' } }
33+
allow(subject).to receive(:raw_info) { { 'id' => 'uid' } }
3434
end
3535

3636
it 'returns the id from raw_info' do
37-
subject.uid.should eq('uid')
37+
expect(subject.uid).to eq('uid')
3838
end
3939
end
4040

4141
describe '#info' do
4242
before :each do
43-
subject.stub(:raw_info) { {} }
43+
allow(subject).to receive(:raw_info) { {} }
4444
end
4545

4646
context 'and therefore has all the necessary fields' do
47-
it { subject.info.should have_key :name }
48-
it { subject.info.should have_key :email }
49-
it { subject.info.should have_key :nickname }
50-
it { subject.info.should have_key :first_name }
51-
it { subject.info.should have_key :last_name }
52-
it { subject.info.should have_key :location }
53-
it { subject.info.should have_key :description }
54-
it { subject.info.should have_key :image }
55-
it { subject.info.should have_key :urls }
47+
it { expect(subject.info).to have_key :name }
48+
it { expect(subject.info).to have_key :email }
49+
it { expect(subject.info).to have_key :nickname }
50+
it { expect(subject.info).to have_key :first_name }
51+
it { expect(subject.info).to have_key :last_name }
52+
it { expect(subject.info).to have_key :location }
53+
it { expect(subject.info).to have_key :description }
54+
it { expect(subject.info).to have_key :image }
55+
it { expect(subject.info).to have_key :urls }
5656
end
5757
end
5858

5959
describe '#extra' do
6060
before :each do
61-
subject.stub(:raw_info) { { :foo => 'bar' } }
61+
allow(subject).to receive(:raw_info) { { :foo => 'bar' } }
6262
end
6363

64-
it { subject.extra['raw_info'].should eq({ :foo => 'bar' }) }
64+
it { expect(subject.extra['raw_info']).to eq({ :foo => 'bar' }) }
6565
end
6666

6767
describe '#access_token' do
6868
before :each do
69-
subject.stub(:oauth2_access_token) { double('oauth2 access token', :expires_in => 3600, :expires_at => 946688400).as_null_object }
69+
allow(subject).to receive(:oauth2_access_token) { double('oauth2 access token', :expires_in => 3600, :expires_at => 946688400).as_null_object }
7070
end
7171

72-
it { subject.access_token.expires_in.should eq(3600) }
73-
it { subject.access_token.expires_at.should eq(946688400) }
72+
it { expect(subject.access_token.expires_in).to eq(3600) }
73+
it { expect(subject.access_token.expires_at).to eq(946688400) }
7474
end
7575

7676
describe '#raw_info' do
7777
before :each do
7878
access_token = double('access token')
7979
response = double('response', :parsed => { :foo => 'bar' })
80-
access_token.should_receive(:get).with("/v1/people/~:(baz,qux)?format=json").and_return(response)
80+
expect(access_token).to receive(:get).with("/v1/people/~:(baz,qux)?format=json").and_return(response)
8181

82-
subject.stub(:option_fields) { ['baz', 'qux'] }
83-
subject.stub(:access_token) { access_token }
82+
allow(subject).to receive(:option_fields) { ['baz', 'qux'] }
83+
allow(subject).to receive(:access_token) { access_token }
8484
end
8585

8686
it 'returns parsed response from access token' do
87-
subject.raw_info.should eq({ :foo => 'bar' })
87+
expect(subject.raw_info).to eq({ :foo => 'bar' })
8888
end
8989
end
9090

@@ -95,27 +95,27 @@
9595
end
9696

9797
it 'sets default scope' do
98-
subject.authorize_params['scope'].should eq('r_basicprofile r_emailaddress')
98+
expect(subject.authorize_params['scope']).to eq('r_basicprofile r_emailaddress')
9999
end
100100
end
101101
end
102102

103103
describe '#option_fields' do
104104
it 'returns options fields' do
105105
subject.stub(:options => double('options', :fields => ['foo', 'bar']).as_null_object)
106-
subject.send(:option_fields).should eq(['foo', 'bar'])
106+
expect(subject.send(:option_fields)).to eq(['foo', 'bar'])
107107
end
108108

109109
it 'http avatar image by default' do
110110
subject.stub(:options => double('options', :fields => ['picture-url']))
111-
subject.options.stub(:[]).with(:secure_image_url).and_return(false)
112-
subject.send(:option_fields).should eq(['picture-url'])
111+
allow(subject.options).to receive(:[]).with(:secure_image_url).and_return(false)
112+
expect(subject.send(:option_fields)).to eq(['picture-url'])
113113
end
114114

115115
it 'https avatar image if secure_image_url truthy' do
116116
subject.stub(:options => double('options', :fields => ['picture-url']))
117-
subject.options.stub(:[]).with(:secure_image_url).and_return(true)
118-
subject.send(:option_fields).should eq(['picture-url;secure=true'])
117+
allow(subject.options).to receive(:[]).with(:secure_image_url).and_return(true)
118+
expect(subject.send(:option_fields)).to eq(['picture-url;secure=true'])
119119
end
120120
end
121121
end

0 commit comments

Comments
 (0)