Skip to content

Commit

Permalink
Add test for configuring the Faraday connection
Browse files Browse the repository at this point in the history
  • Loading branch information
misalcedo authored Nov 7, 2023
1 parent 898adb1 commit 1764cd1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
assert_includes c.connection.builder.handlers, Faraday::Adapter::Test
end

it "allows configuring the Faraday when a block is given" do
assert ElastomerClient::Client.new.connection.builder.handlers.none? { |handler| handler.klass == FaradayMiddleware::Instrumentation }

c = ElastomerClient::Client.new do |connection|
assert_kind_of(Faraday::Connection, connection)

connection.use :instrumentation
end

assert c.connection.builder.handlers.any? { |handler| handler.klass == FaradayMiddleware::Instrumentation }
end

it "use Faraday's default adapter if none is specified" do
c = ElastomerClient::Client.new
adapter = Faraday::Adapter.lookup_middleware(Faraday.default_adapter)
Expand Down

0 comments on commit 1764cd1

Please sign in to comment.