Sha256: e15366a5468d323884535305c5d6a889b612e3eeb00bcf90a7d60689e36d22ef
Contents?: true
Size: 1.11 KB
Versions: 18
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module G5Authenticatable module Test # Helpers for stubbing token validation requests module TokenValidationHelpers def stub_valid_access_token(token_value) stub_request(:get, "#{ENV['G5_AUTH_ENDPOINT']}/oauth/token/info") .with(headers: { 'Authorization' => "Bearer #{token_value}" }) .to_return(status: 200, body: '', headers: {}) end def stub_invalid_access_token(token_value) stub_request(:get, "#{ENV['G5_AUTH_ENDPOINT']}/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: { 'error' => 'invalid_token', 'error_description' => 'The access token expired' } .to_json) end end end end RSpec.configure do |config| config.include G5Authenticatable::Test::TokenValidationHelpers end
Version data entries
18 entries across 18 versions & 1 rubygems