omniauth-windowslive 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4aa5be27e30909564a4718e268fef4cf049d154
4
- data.tar.gz: 50994ff7eab9f2cdbeb96b1fca08be2564cd0e75
3
+ metadata.gz: 8aa55f94a1f5158edbc374bcfc60afa35a0c4802
4
+ data.tar.gz: 5079c3f77ebf8cc7461426fa1e00837d8520db6a
5
5
  SHA512:
6
- metadata.gz: c4afaa195e7dd7c14031be140bf7d95fc8dc5a784e9c9ff5054d9e5619aa6873081e3cdecf4c055a2fa66347c7220b57eb80c02575116b56b17d58a837dc66b7
7
- data.tar.gz: eced3af447ef049b6e92e6b86fd7392c68a15700adf9c191c79fd6fb5484c7e03374a2438730acd10ff07c7e2c96ad7d3c53caac7814c5012820238c3ef80ad9
6
+ metadata.gz: a9640419d2b596afb4a4d402a4a884ead36a4226e9f6ce3836bead398bfbcfcef20d968c26e68b42098a28a024c7712895f77e26c1bf7d7e97b9301a066d47e3
7
+ data.tar.gz: 6fff8eac231717a2453cf862d933c681b7768747808ad5eee878004934d99191e772b27bdd68e50439b0f7d09919258a06034892fb6182bb994818ef885c6ab6
data/Gemfile CHANGED
@@ -6,5 +6,6 @@ gemspec
6
6
 
7
7
  group :test do
8
8
  gem 'coveralls', require: false
9
+ gem 'rb-readline'
9
10
  gem 'pry'
10
11
  end
@@ -52,11 +52,14 @@ module OmniAuth
52
52
  end
53
53
 
54
54
  private
55
-
55
+
56
+ def callback_url
57
+ URI.parse(super).tap { |uri| uri.query = nil }.to_s
58
+ end
59
+
56
60
  def build_access_token
57
- verifier = request.params["code"]
58
- redirect_uri = URI.parse(callback_url).tap { |uri| uri.query = nil }.to_s
59
- client.auth_code.get_token(verifier, {:redirect_uri => redirect_uri}.merge(token_params.to_hash(:symbolize_keys => true)), deep_symbolize(options.auth_token_params))
61
+ verifier = request.params['code']
62
+ client.auth_code.get_token(verifier, { redirect_uri: callback_url }.merge(token_params.to_hash(symbolize_keys: true)), deep_symbolize(options.auth_token_params))
60
63
  end
61
64
 
62
65
  def emails_parser
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Windowslive
3
- VERSION = "0.0.11"
3
+ VERSION = '0.0.12'
4
4
  end
5
5
  end
@@ -18,8 +18,9 @@ Gem::Specification.new do |s|
18
18
  s.require_paths = ["lib"]
19
19
 
20
20
  s.add_dependency 'omniauth-oauth2', '~> 1.4'
21
- s.add_dependency 'multi_json', '>= 1.0.3'
22
- s.add_development_dependency 'rspec', '~> 2.7'
21
+ s.add_dependency 'multi_json', '~> 1.12'
22
+
23
+ s.add_development_dependency 'rspec', '~> 3.5'
23
24
  s.add_development_dependency 'rack-test'
24
25
  s.add_development_dependency 'webmock'
25
26
  end
@@ -2,28 +2,42 @@ require 'spec_helper'
2
2
 
3
3
  describe OmniAuth::Strategies::Windowslive do
4
4
  subject do
5
- OmniAuth::Strategies::Windowslive.new(nil, @options || {})
5
+ OmniAuth::Strategies::Windowslive.new(nil, @options || {}).tap do |strategy|
6
+ strategy.instance_variable_set(:@env, {})
7
+ end
6
8
  end
7
9
 
8
10
  it_should_behave_like 'an oauth2 strategy'
9
11
 
10
12
  describe '#client' do
11
13
  it 'should have the correct Windowslive site' do
12
- subject.client.site.should eq("https://login.live.com")
14
+ expect(subject.client.site).to eq('https://login.live.com')
13
15
  end
14
16
 
15
17
  it 'should have the correct authorization url' do
16
- subject.client.options[:authorize_url].should eq("/oauth20_authorize.srf")
18
+ expect(subject.client.options[:authorize_url]).to eq('/oauth20_authorize.srf')
17
19
  end
18
20
 
19
21
  it 'should have the correct token url' do
20
- subject.client.options[:token_url].should eq('/oauth20_token.srf')
22
+ expect(subject.client.options[:token_url]).to eq('/oauth20_token.srf')
21
23
  end
22
24
  end
23
25
 
24
- describe '#callback_path' do
25
- it 'should have the correct callback path' do
26
- subject.callback_path.should eq('/auth/windowslive/callback')
26
+ describe '#callback' do
27
+ let(:callback_url) { '/auth/windowslive/callback' }
28
+
29
+ describe '#callback_path' do
30
+ it 'should have the correct callback path' do
31
+ expect(subject.callback_path).to eq(callback_url)
32
+ end
33
+ end
34
+
35
+ describe '#callback_url' do
36
+ before { expect(subject).to receive(:query_string) { '?key=value' } }
37
+
38
+ it 'should remove query string from callback url' do
39
+ expect(subject.send(:callback_url)).to eq(callback_url)
40
+ end
27
41
  end
28
42
  end
29
43
  end
@@ -16,4 +16,6 @@ Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
16
16
  RSpec.configure do |config|
17
17
  config.include Rack::Test::Methods
18
18
  config.extend OmniAuth::Test::StrategyMacros, type: :strategy
19
+
20
+ OmniAuth.config.test_mode = true
19
21
  end
@@ -1,47 +1,38 @@
1
1
  # NOTE it would be useful if this lived in omniauth-oauth2 eventually
2
2
 
3
3
  shared_examples 'an oauth2 strategy' do
4
- before do
5
- OmniAuth.config.test_mode = true
6
- end
7
-
8
- after do
9
- OmniAuth.config.test_mode = false
10
- end
11
-
12
4
  describe '#client' do
13
5
  it 'should be initialized with symbolized client_options' do
14
- @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
15
- subject.client.options[:authorize_url].should == 'https://example.com'
6
+ @options = { client_options: { 'authorize_url' => 'https://example.com' } }
7
+ expect(subject.client.options[:authorize_url]).to eq('https://example.com')
16
8
  end
17
9
  end
18
10
 
19
11
  describe '#authorize_params' do
20
12
  it 'should include any authorize params passed in the :authorize_params option' do
21
- @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
22
- subject.authorize_params['foo'].should eq('bar')
23
- subject.authorize_params['baz'].should eq('zip')
13
+ @options = { authorize_params: { foo: 'bar', baz: 'zip' } }
14
+ expect(subject.authorize_params['foo']).to eq('bar')
15
+ expect(subject.authorize_params['baz']).to eq('zip')
24
16
  end
25
17
 
26
18
  it 'should include top-level options that are marked as :authorize_options' do
27
- @options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
28
- subject.authorize_params['scope'].should eq('bar')
29
- subject.authorize_params['foo'].should eq('baz')
19
+ @options = { authorize_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
20
+ expect(subject.authorize_params['scope']).to eq('bar')
21
+ expect(subject.authorize_params['foo']).to eq('baz')
30
22
  end
31
23
  end
32
24
 
33
25
  describe '#token_params' do
34
26
  it 'should include any token params passed in the :token_params option' do
35
- @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
36
- subject.token_params['foo'].should eq('bar')
37
- subject.token_params['baz'].should eq('zip')
27
+ @options = { token_params: { foo: 'bar', baz: 'zip' } }
28
+ expect(subject.token_params['foo']).to eq('bar')
29
+ expect(subject.token_params['baz']).to eq('zip')
38
30
  end
39
31
 
40
32
  it 'should include top-level options that are marked as :token_options' do
41
- @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
42
- subject.token_params['scope'].should eq('bar')
43
- subject.token_params['foo'].should eq('baz')
33
+ @options = { token_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
34
+ expect(subject.token_params['scope']).to eq('bar')
35
+ expect(subject.token_params['foo']).to eq('baz')
44
36
  end
45
37
  end
46
38
  end
47
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-windowslive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel AZEMAR
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2017-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: multi_json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.3
33
+ version: '1.12'
34
34
  type: :runtime
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: 1.0.3
40
+ version: '1.12'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.7'
47
+ version: '3.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.7'
54
+ version: '3.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack-test
57
57
  requirement: !ruby/object:Gem::Requirement