Sha256: 4bd57e5fddbf5f895b7cc4246d4c21d40b9985de99cb879dd661d79bb60d0c18

Contents?: true

Size: 939 Bytes

Versions: 2

Compression:

Stored size: 939 Bytes

Contents

# frozen_string_literal: true

RSpec.shared_context 'current auth user' do
  before do
    stub_request(:get, 'auth.g5search.com/v1/me')
      .with(headers: { 'Authorization' => "Bearer #{token_value}" })
      .to_return(status: 200,
                 body: raw_user_info.to_json,
                 headers: { 'Content-Type' => 'application/json' })
  end

  let(:raw_user_info) do
    {
      'id' => 42,
      'email' => 'fred.rogers@thehood.net',
      'first_name' => 'Fred',
      'last_name' => 'Rogers',
      'phone_number' => '(555) 555-1212',
      'organization_name' => 'The Neighborhood',
      'title' => 'Head Cardigan Wearer',
      'roles' => [
        {
          'name' => 'viewer',
          'type' => 'GLOBAL',
          'urn' => nil
        },
        {
          'name' => 'admin',
          'type' => 'G5Updatable::Client',
          'urn' => 'g5-c-some-randomly-generated-string'
        }
      ]
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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