Sha256: d20eac966dccc719cd0c307918c9334659b41ba5de3b7c179836f6c985ef73aa

Contents?: true

Size: 1.03 KB

Versions: 48

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper.rb'

describe Rack::OAuth2::Server::Token::RefreshToken do
  let(:request) { Rack::MockRequest.new app }
  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
  let(:params) do
    {
      grant_type: "refresh_token",
      client_id: "client_id",
      refresh_token: "refresh_token"
    }
  end
  subject { request.post('/', params: params) }

  its(:status)       { should == 200 }
  its(:content_type) { should == 'application/json' }
  its(:body)         { should include '"access_token":"access_token"' }
  its(:body)         { should include '"token_type":"bearer"' }

  context 'when refresh_token is missing' do
    before do
      params.delete_if do |key, value|
        key == :refresh_token
      end
    end
    its(:status)       { should == 400 }
    its(:content_type) { should == 'application/json' }
    its(:body)         { should include '"error":"invalid_request"' }
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
rack-oauth2-2.2.1 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-2.2.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-2.1.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-2.0.1 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-2.0.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-2.0.0.rc3 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-2.0.0.rc2 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-2.0.0.rc1 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.21.3 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.21.2 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.21.1 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.21.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.20.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.19.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.18.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.17.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.16.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.15.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.14.0 spec/rack/oauth2/server/token/refresh_token_spec.rb
rack-oauth2-1.13.0 spec/rack/oauth2/server/token/refresh_token_spec.rb