Sha256: b3f1247cddb0f8fb7cd2aea631f45e19b935dff39910cb1465238233737a312d
Contents?: true
Size: 900 Bytes
Versions: 10
Compression:
Stored size: 900 Bytes
Contents
require 'rails_helper' describe LHC do context 'interceptor' do before(:each) do class SomeInterceptor < LHC::Interceptor end class AnotherInterceptor < LHC::Interceptor end end it 'performs interceptor when they are set globally' do LHC.configure { |c| c.interceptors = [SomeInterceptor] } expect_any_instance_of(SomeInterceptor).to receive(:before_request) stub_request(:get, 'http://local.ch') LHC.get('http://local.ch') end it 'overrides interceptors on request level' do LHC.configure { |c| c.interceptors = [SomeInterceptor] } expect_any_instance_of(AnotherInterceptor).to receive(:before_request) expect_any_instance_of(SomeInterceptor).not_to receive(:before_request) stub_request(:get, 'http://local.ch') LHC.get('http://local.ch', interceptors: [AnotherInterceptor]) end end end
Version data entries
10 entries across 10 versions & 1 rubygems