Sha256: 99bf4ac27f44515d5b84f9de2d3f7b2db583f822cb5ed1db5d9a330c4cafb6f0

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper.rb'

describe Rack::OAuth2::Server::Token::RefreshToken do
  subject { response }
  let(:request) { Rack::MockRequest.new app }
  let :response do
    request.post('/', :params => {
      :grant_type => "refresh_token",
      :client_id => "client_id",
      :refresh_token => "refresh_token"
    })
  end
  let :id_token do
    OpenIDConnect::ResponseObject::IdToken.new(
      :iss => 'https://server.example.com',
      :user_id => 'user_id',
      :aud => 'client_id',
      :exp => 1313424327,
      :secret => 'secret'
    ).to_jwt private_key
  end

  context "when id_token is given" do
    let :app do
      Rack::OAuth2::Server::Token.new do |request, response|
        response.access_token = Rack::OAuth2::AccessToken::Bearer.new(:access_token => 'access_token')
        response.id_token = id_token
      end
    end
    its(:status) { should == 200 }
    its(:body)   { should include "\"id_token\":\"#{id_token}\"" }

    context 'when id_token is String' do
      let(:id_token) { 'id_token' }
      its(:body)     { should include "\"id_token\":\"id_token\"" }
    end
  end

  context "otherwise" do
    let :app do
      Rack::OAuth2::Server::Token.new do |request, response|
        response.access_token = Rack::OAuth2::AccessToken::Bearer.new(:access_token => 'access_token')
      end
    end
    its(:status) { should == 200 }
    its(:body)   { should_not include "id_token" }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
openid_connect-0.1.1 spec/rack/oauth2/server/token/refresh_token_spec.rb
openid_connect-0.1.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
openid_connect-0.0.33 spec/rack/oauth2/server/token/refresh_token_spec.rb
openid_connect-0.0.32 spec/rack/oauth2/server/token/refresh_token_spec.rb
openid_connect-0.0.31 spec/rack/oauth2/server/token/refresh_token_spec.rb
openid_connect-0.0.30 spec/rack/oauth2/server/token/refresh_token_spec.rb
openid_connect-0.0.29 spec/rack/oauth2/server/token/refresh_token_spec.rb
openid_connect-0.0.28 spec/rack/oauth2/server/token/refresh_token_spec.rb