Sha256: 4ce20ffb3b8caf2f6695b2fa137beae35fd72fed7f2742a504ab31480478284b

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 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 => 'bar', :foo => 'baz' }
    #   subject.authorize_params['scope'].should eq('bar')
    #   subject.authorize_params['foo'].should eq('baz')
    # end
  # end

  describe '#token_params' do
    it 'should include any authorize params passed in the :authorize_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 :authorize_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

3 entries across 3 versions & 1 rubygems

Version Path
omniauth-fitcvut-oauth2-0.2.1 spec/support/shared_examples.rb
omniauth-fitcvut-oauth2-0.2.0 spec/support/shared_examples.rb
omniauth-fitcvut-oauth2-0.1.0 spec/support/shared_examples.rb