Sha256: b8b164296a1629e8030caf9a6c6397513c3b2750513f8718deaf54ad019a4b86

Contents?: true

Size: 1.57 KB

Versions: 11

Compression:

Stored size: 1.57 KB

Contents

# NOTE it would be useful if this lived in omniauth-oauth2 eventually
shared_examples 'an oauth2 strategy' do
  describe '#client' do
    it 'should be initialized with symbolized client_options' do
      @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
      expect(subject.client.options[:authorize_url]).to eq('https://example.com')
    end
  end

  describe '#authorize_params' do
    it 'should include any authorize params passed in the :authorize_params option' do
      @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
      expect(subject.authorize_params['foo']).to eq('bar')
      expect(subject.authorize_params['baz']).to eq('zip')
    end

    it 'should include top-level options that are marked as :authorize_options' do
      @options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
      expect(subject.authorize_params['scope']).to eq('bar')
      expect(subject.authorize_params['foo']).to eq('baz')
    end
  end

  describe '#token_params' do
    it 'should include any token params passed in the :token_params option' do
      @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
      expect(subject.token_params['foo']).to eq('bar')
      expect(subject.token_params['baz']).to eq('zip')
    end

    it 'should include top-level options that are marked as :token_options' do
      @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
      expect(subject.token_params['scope']).to eq('bar')
      expect(subject.token_params['foo']).to eq('baz')
    end
  end
end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
omniauth-boletosimples-0.0.9 spec/support/shared_examples.rb
omniauth-boletosimples-0.0.8 spec/support/shared_examples.rb
omniauth-paypal-oauth2-1.4.4 spec/support/shared_examples.rb
omniauth-paypal-oauth2-1.4.3 spec/support/shared_examples.rb
omniauth-paypal-oauth2-1.4.2 spec/support/shared_examples.rb
omniauth-paypal-oauth2-1.4.1 spec/support/shared_examples.rb
omniauth-paypal-oauth2-1.4.0 spec/support/shared_examples.rb
omniauth-paypal-permissions-1.0.0 spec/support/shared_examples.rb
omniauth-boletosimples-0.0.7 spec/support/shared_examples.rb
omniauth-paypal-1.3 spec/support/shared_examples.rb
omniauth-boletosimples-0.0.6 spec/support/shared_examples.rb