omniauth-windowslive 0.0.11 → 0.0.12
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 +4 -4
- data/Gemfile +1 -0
- data/lib/omniauth/strategies/windowslive.rb +7 -4
- data/lib/omniauth/windowslive/version.rb +1 -1
- data/omniauth-windowslive.gemspec +3 -2
- data/spec/omniauth/strategies/windowslive_spec.rb +21 -7
- data/spec/spec_helper.rb +2 -0
- data/spec/support/shared_examples.rb +14 -23
- metadata +8 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8aa55f94a1f5158edbc374bcfc60afa35a0c4802
         | 
| 4 | 
            +
              data.tar.gz: 5079c3f77ebf8cc7461426fa1e00837d8520db6a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a9640419d2b596afb4a4d402a4a884ead36a4226e9f6ce3836bead398bfbcfcef20d968c26e68b42098a28a024c7712895f77e26c1bf7d7e97b9301a066d47e3
         | 
| 7 | 
            +
              data.tar.gz: 6fff8eac231717a2453cf862d933c681b7768747808ad5eee878004934d99191e772b27bdd68e50439b0f7d09919258a06034892fb6182bb994818ef885c6ab6
         | 
    
        data/Gemfile
    CHANGED
    
    
| @@ -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[ | 
| 58 | 
            -
                     | 
| 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
         | 
| @@ -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', ' | 
| 22 | 
            -
             | 
| 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. | 
| 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]. | 
| 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]. | 
| 22 | 
            +
                  expect(subject.client.options[:token_url]).to eq('/oauth20_token.srf')
         | 
| 21 23 | 
             
                end
         | 
| 22 24 | 
             
              end
         | 
| 23 25 |  | 
| 24 | 
            -
              describe '# | 
| 25 | 
            -
                 | 
| 26 | 
            -
             | 
| 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
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
| @@ -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 = { : | 
| 15 | 
            -
                  subject.client.options[:authorize_url]. | 
| 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 = { : | 
| 22 | 
            -
                  subject.authorize_params['foo']. | 
| 23 | 
            -
                  subject.authorize_params['baz']. | 
| 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 = { : | 
| 28 | 
            -
                  subject.authorize_params['scope']. | 
| 29 | 
            -
                  subject.authorize_params['foo']. | 
| 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 = { : | 
| 36 | 
            -
                  subject.token_params['foo']. | 
| 37 | 
            -
                  subject.token_params['baz']. | 
| 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 = { : | 
| 42 | 
            -
                  subject.token_params['scope']. | 
| 43 | 
            -
                  subject.token_params['foo']. | 
| 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. | 
| 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:  | 
| 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. | 
| 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. | 
| 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: ' | 
| 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: ' | 
| 54 | 
            +
                    version: '3.5'
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: rack-test
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         |