Sha256: 2230f8c2b2baf26059c4c992b4542e9a92d13e3233052de8e9cdb4624ff4510b

Contents?: true

Size: 779 Bytes

Versions: 2

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true

RSpec.shared_context 'OAuth2 error' do
  before do
    stub_request(:get, 'auth.g5search.com/oauth/token/info')
      .with(headers: { 'Authorization' => "Bearer #{token_value}" })
      .to_return(status: 401,
                 headers: { 'Content-Type' => 'application/json; charset=utf-8',
                            'Cache-Control' => 'no-cache' },
                 body: parsed_error.to_json)
  end

  let(:parsed_error) { '' }
end

RSpec.shared_context 'invalid access token' do
  include_context 'OAuth2 error' do
    let(:parsed_error) do
      { 'error' => error_code,
        'error_description' => error_description }
    end

    let(:error_code) { 'invalid_token' }
    let(:error_description) { 'The access token expired' }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
g5_authenticatable_api-1.0.0 spec/support/shared_contexts/invalid_access_token.rb
g5_authenticatable_api-1.0.0.pre.1 spec/support/shared_contexts/invalid_access_token.rb