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-15.2.1 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-15.2.0 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-15.1.3 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-15.1.2 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-15.1.1 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-15.1.0 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-16.0.0.pre.pro2162.2 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-16.0.0.pre.pro2162 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-15.0.1 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-15.0.0 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-14.0.0 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-13.4.0.pre.pro1766.1 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-13.2.0 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-13.1.0 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-13.0.0 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-12.3.0 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-12.2.1 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-12.2.0 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-12.1.3 spec/interceptors/auth/no_instance_var_for_options_spec.rb
lhc-12.1.2 spec/interceptors/auth/no_instance_var_for_options_spec.rb