Sha256: 6dd769503bb0a8f51b35a75d01945d2b336eaa3bd4e6f45132348eb3ab2f5248

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe OmniAuth::Strategies::ActivePassport do
  def app; lambda{|env| [200, {}, ["Hello."]]} end
  let(:fresh_strategy){ Class.new(OmniAuth::Strategies::ActivePassport) }

  describe '#client' do
    subject{ fresh_strategy }

    it 'should be initialized with symbolized client_options' do
      instance = subject.new(app, :client_options => {'authorize_url' => 'https://example.com'})
      instance.client.options[:authorize_url].should == 'https://example.com'
    end
  end

  describe '#token_params' do
    subject { fresh_strategy }

    it 'should include parse => json as well as any authorize params passed in the :authorize_params option' do
      instance = subject.new('abc', 'def', :token_params => {:foo => 'bar', :baz => 'zip'})
      instance.token_params.should == {'foo' => 'bar', 'baz' => 'zip', 'parse' => :json}
    end

    it 'should include parse => json as well as any top-level options that are marked as :authorize_options' do
      instance = subject.new('abc', 'def', :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz')
      instance.token_params.should == {'scope' => 'bar', 'foo' => 'baz', 'parse' => :json}
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
omniauth-active-passport-0.0.2.1 spec/omniauth/strategies/active_passport_spec.rb
omniauth-active-passport-0.0.2 spec/omniauth/strategies/active_passport_spec.rb
omniauth-active_passport-0.0.3 spec/omniauth/strategies/active_passport_spec.rb