omniauth-angellist 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7fcf72d337a95f545086adb06cbfa76da04769a
4
- data.tar.gz: 93e9c47c0b32cf70b8919e2165047309bbd99ff2
3
+ metadata.gz: c6459eaa408922092e18ed8f0be13e74dc73af28
4
+ data.tar.gz: 55e84be3cb787d439c29b7e4ff21f86a799b73cb
5
5
  SHA512:
6
- metadata.gz: 5350bee46f7b08f55208773c97262aa5b9a80de9661919e807881cdccd52619b0a9eaef31ad40a2b2b93dea991ad2e2e2b6cbd43cfcad2bd2b6634b1c8b2712c
7
- data.tar.gz: f149fee4067aa28c82a9c688bd3b8915d9ecd7398456dbfcf6d2303176e537baf366aa05177c882aed4067724ed03786717f0b4d6acddc8fc4a7dafc23efe186
6
+ metadata.gz: 2c86983f8dcfce830ded4c7eadeb782a7fd0d1e946514ce3937dc5c30a7b29b69c34dbe35f3a92ea8ceb857d1ca4ea12457f19da095bef36e91f5eb78c67045d
7
+ data.tar.gz: f6984caac274ae5aa80839fd92d78934ae1873c97f2315a3606208a2119b494375da00ebe958f749b7a644e50dac12ed67e6b75cf91388401cdeb0c15235da21
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module AngelList
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'.freeze
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@ require 'omniauth/strategies/oauth2'
3
3
  module OmniAuth
4
4
  module Strategies
5
5
  class AngelList < OmniAuth::Strategies::OAuth2
6
- DEFAULT_SCOPE = 'email'
6
+ DEFAULT_SCOPE = 'email'.freeze
7
7
 
8
8
  option :client_options, {
9
9
  site: 'https://angel.co/',
@@ -44,13 +44,12 @@ module OmniAuth
44
44
 
45
45
  credentials do
46
46
  hash = { 'token' => access_token.token }
47
- hash.merge!('refresh_token' => access_token.refresh_token) if
47
+ hash['refresh_token'] = access_token.refresh_token if
48
48
  access_token.expires? && access_token.refresh_token
49
- hash.merge!('expires_at' => access_token.expires_at) if
49
+ hash['expires_at'] = access_token.expires_at if
50
50
  access_token.expires?
51
- hash.merge!('expires' => access_token.expires?)
52
- hash.merge!(
53
- 'scope' => raw_info['scopes'] ? raw_info['scopes'].join(' ') : nil)
51
+ hash['expires'] = access_token.expires?
52
+ hash['scope'] = raw_info['scopes'] ? raw_info['scopes'].join(' ') : nil
54
53
  prune!(hash)
55
54
  end
56
55
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.email = ['srabuini@gmail.com']
9
9
  s.homepage = 'https://github.com/wasabit/omniauth-angellist'
10
10
  s.summary = 'AngelList OAuth strategy for OmniAuth'
11
- s.description = 'AngelList OAuth strategy for OmniAuth'
11
+ s.description = 'AngelList OAuth strategy for OmniAuth.'
12
12
  s.license = 'MIT'
13
13
 
14
14
  s.rubyforge_project = 'omniauth-angellist'
@@ -19,8 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ['lib']
20
20
 
21
21
  s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
22
- s.add_development_dependency 'rspec', '~> 2.7'
23
- s.add_development_dependency 'rack-test'
24
- s.add_development_dependency 'simplecov'
25
- s.add_development_dependency 'webmock'
22
+ s.add_development_dependency 'rspec', '~> 3.5'
26
23
  end
@@ -4,7 +4,7 @@ require 'omniauth-angellist'
4
4
  describe OmniAuth::Strategies::AngelList do
5
5
  before :each do
6
6
  @request = double('Request')
7
- @request.stub(:params) { {} }
7
+ allow(@request).to receive(:params).and_return({})
8
8
  @client_id = '123'
9
9
  @client_secret = 'afalsf'
10
10
  @raw_info = {
@@ -45,7 +45,7 @@ describe OmniAuth::Strategies::AngelList do
45
45
  subject do
46
46
  args = [@client_id, @client_secret, @options].compact
47
47
  OmniAuth::Strategies::AngelList.new(nil, *args).tap do |strategy|
48
- strategy.stub(:request) { @request }
48
+ allow(strategy).to receive(:request).and_return(@request)
49
49
  end
50
50
  end
51
51
 
@@ -53,108 +53,108 @@ describe OmniAuth::Strategies::AngelList do
53
53
 
54
54
  describe '#client' do
55
55
  it 'has correct AngelList site' do
56
- subject.client.site.should eq('https://angel.co/')
56
+ expect(subject.client.site).to eq('https://angel.co/')
57
57
  end
58
58
 
59
59
  it 'has correct authorize url' do
60
- subject.client.options[:authorize_url].should eq('https://angel.co/api/oauth/authorize')
60
+ expect(subject.client.options[:authorize_url]).to eq('https://angel.co/api/oauth/authorize')
61
61
  end
62
62
 
63
63
  it 'has correct token url' do
64
- subject.client.options[:token_url].should eq('https://angel.co/api/oauth/token')
64
+ expect(subject.client.options[:token_url]).to eq('https://angel.co/api/oauth/token')
65
65
  end
66
66
  end
67
67
 
68
68
  describe '#info' do
69
69
  before :each do
70
- subject.stub(:raw_info) { @raw_info }
70
+ allow(subject).to receive(:raw_info).and_return(@raw_info)
71
71
  end
72
72
 
73
73
  context 'when data is present in raw info' do
74
74
  it 'returns the combined name' do
75
- subject.info['name'].should eq('Sebastian Rabuini')
75
+ expect(subject.info['name']).to eq('Sebastian Rabuini')
76
76
  end
77
77
 
78
78
  it 'returns the bio' do
79
- subject.info['bio'].should eq('Sebas')
79
+ expect(subject.info['bio']).to eq('Sebas')
80
80
  end
81
81
 
82
82
  it 'returns the image' do
83
- subject.info['image'].should eq(@raw_info['image'])
83
+ expect(subject.info['image']).to eq(@raw_info['image'])
84
84
  end
85
85
 
86
86
  it 'return the email' do
87
- subject.info['email'].should eq('sebas@wasabit.com.ar')
87
+ expect(subject.info['email']).to eq('sebas@wasabit.com.ar')
88
88
  end
89
89
 
90
90
  it 'return skills' do
91
- subject.info['skills'].first['name'].should eq('ruby on rails')
91
+ expect(subject.info['skills'].first['name']).to eq('ruby on rails')
92
92
  end
93
93
  end
94
94
  end
95
95
 
96
96
  describe '#authorize_params' do
97
97
  before :each do
98
- subject.stub(session: {})
98
+ allow(subject).to receive(:session).and_return({})
99
99
  end
100
100
 
101
101
  it 'includes default scope for email' do
102
- subject.authorize_params['scope'].should eq('email')
102
+ expect(subject.authorize_params['scope']).to eq('email')
103
103
  end
104
104
  end
105
105
 
106
106
  describe '#credentials' do
107
107
  before :each do
108
108
  @access_token = double('OAuth2::AccessToken')
109
- @access_token.stub(:token) { '123' } # Token is always required
110
- @access_token.stub(:expires?)
111
- @access_token.stub(:expires_at)
112
- @access_token.stub(:refresh_token)
113
- subject.stub(:access_token) { @access_token }
114
- subject.stub(:raw_info) { @raw_info }
109
+ allow(@access_token).to receive(:token).and_return('123')
110
+ allow(@access_token).to receive(:expires?)
111
+ allow(@access_token).to receive(:expires_at)
112
+ allow(@access_token).to receive(:refresh_token)
113
+ allow(subject).to receive(:access_token).and_return(@access_token)
114
+ allow(subject).to receive(:raw_info).and_return(@raw_info)
115
115
  end
116
116
 
117
117
  it 'returns a Hash' do
118
- subject.credentials.should be_a(Hash)
118
+ expect(subject.credentials).to be_a(Hash)
119
119
  end
120
120
 
121
121
  it 'returns the token' do
122
- subject.credentials['token'].should eq('123')
122
+ expect(subject.credentials['token']).to eq('123')
123
123
  end
124
124
 
125
125
  it 'return scopes' do
126
- subject.credentials['scope'].should eq('email comment message talent')
126
+ expect(subject.credentials['scope']).to eq('email comment message talent')
127
127
  end
128
128
 
129
129
  it 'returns the expiry status' do
130
- @access_token.stub(:expires?) { true }
131
- subject.credentials['expires'].should eq(true)
130
+ allow(@access_token).to receive(:expires?) { true }
131
+ expect(subject.credentials['expires']).to eq(true)
132
132
 
133
- @access_token.stub(:expires?) { false }
134
- subject.credentials['expires'].should eq(false)
133
+ allow(@access_token).to receive(:expires?) { false }
134
+ expect(subject.credentials['expires']).to eq(false)
135
135
  end
136
136
 
137
137
  it 'returns the refresh token and expiry time when expiring' do
138
138
  ten_mins_from_now = (Time.now + 360).to_i
139
- @access_token.stub(:expires?) { true }
140
- @access_token.stub(:refresh_token) { '321' }
141
- @access_token.stub(:expires_at) { ten_mins_from_now }
142
- subject.credentials['refresh_token'].should eq('321')
143
- subject.credentials['expires_at'].should eq(ten_mins_from_now)
139
+ allow(@access_token).to receive(:expires?) { true }
140
+ allow(@access_token).to receive(:refresh_token) { '321' }
141
+ allow(@access_token).to receive(:expires_at) { ten_mins_from_now }
142
+ expect(subject.credentials['refresh_token']).to eq('321')
143
+ expect(subject.credentials['expires_at']).to eq(ten_mins_from_now)
144
144
  end
145
145
 
146
146
  it 'does not return the refresh token when it is nil and expiring' do
147
- @access_token.stub(:expires?) { true }
148
- @access_token.stub(:refresh_token) { nil }
149
- subject.credentials['refresh_token'].should be_nil
150
- subject.credentials.should_not have_key('refresh_token')
147
+ allow(@access_token).to receive(:expires?) { true }
148
+ allow(@access_token).to receive(:refresh_token) { nil }
149
+ expect(subject.credentials['refresh_token']).to be_nil
150
+ expect(subject.credentials).to_not have_key('refresh_token')
151
151
  end
152
152
 
153
153
  it 'does not return the refresh token when not expiring' do
154
- @access_token.stub(:expires?) { false }
155
- @access_token.stub(:refresh_token) { 'XXX' }
156
- subject.credentials['refresh_token'].should be_nil
157
- subject.credentials.should_not have_key('refresh_token')
154
+ allow(@access_token).to receive(:expires?) { false }
155
+ allow(@access_token).to receive(:refresh_token) { 'XXX' }
156
+ expect(subject.credentials['refresh_token']).to be_nil
157
+ expect(subject.credentials).to_not have_key('refresh_token')
158
158
  end
159
159
  end
160
160
  end
@@ -3,21 +3,22 @@ shared_examples 'an oauth2 strategy' do
3
3
  it 'should be initialized with symbolized client_options' do
4
4
  @options = { client_options:
5
5
  { 'authorize_url' => 'https://example.com' } }
6
- subject.client.options[:authorize_url].should == 'https://example.com'
6
+ expect(subject.client.options[:authorize_url])
7
+ .to eq('https://example.com')
7
8
  end
8
9
  end
9
10
 
10
11
  describe '#token_params' do
11
12
  it 'should include any params passed in the :authorize_params option' do
12
13
  @options = { token_params: { foo: 'bar', baz: 'zip' } }
13
- subject.token_params['foo'].should eq('bar')
14
- subject.token_params['baz'].should eq('zip')
14
+ expect(subject.token_params['foo']).to eq('bar')
15
+ expect(subject.token_params['baz']).to eq('zip')
15
16
  end
16
17
 
17
18
  it 'should include top-level options marked as :authorize_options' do
18
19
  @options = { token_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
19
- subject.token_params['scope'].should eq('bar')
20
- subject.token_params['foo'].should eq('baz')
20
+ expect(subject.token_params['scope']).to eq('bar')
21
+ expect(subject.token_params['foo']).to eq('baz')
21
22
  end
22
23
  end
23
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-angellist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Rabuini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-25 00:00:00.000000000 Z
11
+ date: 2017-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -30,57 +30,15 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.7'
33
+ version: '3.5'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.7'
41
- - !ruby/object:Gem::Dependency
42
- name: rack-test
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: simplecov
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: webmock
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- description: AngelList OAuth strategy for OmniAuth
40
+ version: '3.5'
41
+ description: AngelList OAuth strategy for OmniAuth.
84
42
  email:
85
43
  - srabuini@gmail.com
86
44
  executables: []
@@ -118,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
76
  version: '0'
119
77
  requirements: []
120
78
  rubyforge_project: omniauth-angellist
121
- rubygems_version: 2.4.5
79
+ rubygems_version: 2.6.4
122
80
  signing_key:
123
81
  specification_version: 4
124
82
  summary: AngelList OAuth strategy for OmniAuth