Sha256: 2d921baac36d2a995cf90a846d4c721b072857456568d8e8415960d4ae93bd0a

Contents?: true

Size: 1.02 KB

Versions: 17

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper.rb'

describe Rack::OAuth2::Client::Grant::AuthorizationCode do
  let(:redirect_uri) { 'https://client.example.com/callback' }
  let(:grant) { Rack::OAuth2::Client::Grant::AuthorizationCode }

  context 'when code is given' do
    let :attributes do
      {:code => 'code'}
    end

    context 'when redirect_uri is given' do
      let :attributes do
        {:code => 'code', :redirect_uri => redirect_uri}
      end
      subject { grant.new attributes }
      its(:redirect_uri) { should == redirect_uri }
      its(:as_json) do
        should == {:grant_type => :authorization_code, :code => 'code', :redirect_uri => redirect_uri}
      end
    end

    context 'otherwise' do
      subject { grant.new attributes }
      its(:redirect_uri) { should be_nil }
      its(:as_json) do
        should == {:grant_type => :authorization_code, :code => 'code', :redirect_uri => nil}
      end
    end
  end

  context 'otherwise' do
    it do
      expect { grant.new }.to raise_error AttrRequired::AttrMissing
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
rack-oauth2-1.1.1 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.1.0 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.10 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.9 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.8 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-revibe-1.0.7 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.7 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.6 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.5 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.4 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.3 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.2 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.1 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-1.0.0 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-0.14.9 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-0.14.8 spec/rack/oauth2/client/grant/authorization_code_spec.rb
rack-oauth2-0.14.7 spec/rack/oauth2/client/grant/authorization_code_spec.rb