Sha256: 8b934b486a0c7d998bd3f89eeaf1c1cd295196d274baeae0c81df04185652cfe

Contents?: true

Size: 1.54 KB

Versions: 18

Compression:

Stored size: 1.54 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' } }
      subject.client.options[:authorize_url].should == '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' } }
      subject.authorize_params['foo'].should eq('bar')
      subject.authorize_params['baz'].should eq('zip')
    end

    it 'should include top-level options that are marked as :authorize_options' do
      @options = { :authorize_options => [:scope, :foo], :scope => 'http://bar', :foo => 'baz' }
      subject.authorize_params['scope'].should eq('http://bar')
      subject.authorize_params['foo'].should 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' } }
      subject.token_params['foo'].should eq('bar')
      subject.token_params['baz'].should 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' }
      subject.token_params['scope'].should eq('bar')
      subject.token_params['foo'].should eq('baz')
    end
  end
end

Version data entries

18 entries across 18 versions & 5 rubygems

Version Path
omniauth-accounts-0.1.2 spec/support/shared_examples.rb
omniauth-accounts-0.1.1 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.19 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.18 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.17 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.16 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.15 spec/support/shared_examples.rb
omniauth-allied_modders-0.0.1 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.13 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.12 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.11 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.10 spec/support/shared_examples.rb
omniauth-google-oauth2-moses-0.1.10 spec/support/shared_examples.rb
omniauth-mailchimp-1.0.2 spec/support/shared_examples.rb
omniauth-mailchimp-1.0.1 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.9 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.8 spec/support/shared_examples.rb
omniauth-google-oauth2-0.1.7 spec/support/shared_examples.rb