Sha256: 2eaa1fb2430dd38a14140497da27c214ef4afc80a4d550ab24e2af458f92df2c
Contents?: true
Size: 898 Bytes
Versions: 70
Compression:
Stored size: 898 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
70 entries across 70 versions & 1 rubygems