Sha256: fae85b3bea0486df1c112fb8ba4d3a6b1c135219709e377c79b27fe43bf735d2

Contents?: true

Size: 644 Bytes

Versions: 21

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe LHC::Auth do
  before(:each) do
    class AuthPrepInterceptor < LHC::Interceptor

      def before_request
        request.options[:auth] = { bearer: 'sometoken' }
      end
    end

    LHC.config.interceptors = [AuthPrepInterceptor, LHC::Auth]
  end

  after do
    LHC.config.reset
  end

  it 'does not use instance variables internally so that other interceptors can still change auth options' do
    stub_request(:get, "http://local.ch/")
      .with(headers: { 'Authorization' => 'Bearer sometoken' })
      .to_return(status: 200)
    LHC.get('http://local.ch')
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
lhc-12.1.1 spec/interceptors/auth/no_instance_var_for_options_spec.rb