File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ class Configuration
3737 # The Faraday adapter to be used. Will default to Net::HTTP when not set.
3838 attr_accessor :http_adapter
3939
40+ # A Proc yeilding the faraday builder allowing for further configuration
41+ # of the faraday adapter
42+ attr_accessor :faraday_builder
43+
4044 # You may provide your own LineCache for matching paths with source files.
4145 # This may be useful if you need to get source code from places other than
4246 # the disk. See Raven::LineCache for the required interface you must implement.
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ def set_conn
4848 :url => configuration [ :server ] ,
4949 :ssl => ssl_configuration
5050 ) do |builder |
51+ configuration . faraday_builder . call ( builder ) if configuration . faraday_builder
5152 builder . response :raise_error
5253 builder . adapter ( *adapter )
5354 end
Original file line number Diff line number Diff line change 4646
4747 stubs . verify_stubbed_calls
4848 end
49+
50+ it 'allows to customise faraday' do
51+ builder = spy ( 'faraday_builder' )
52+ expect ( Faraday ) . to receive ( :new ) . and_yield ( builder )
53+
54+ Raven . configure do |config |
55+ config . faraday_builder = proc { |b | b . request :instrumentation }
56+ end
57+
58+ Raven . client . send ( :transport )
59+
60+ expect ( builder ) . to have_received ( :request ) . with ( :instrumentation )
61+ end
4962end
You can’t perform that action at this time.
0 commit comments