Skip to content

Commit

Permalink
Fix tests for Faraday 1.0
Browse files Browse the repository at this point in the history
The adapter is now stored separately (it's been that way for some time,
but we're newly using the new mechanism after upgrading).

Before:

```
<Faraday::RackBuilder:0x00000001237fabb0 @handlers=[ElastomerClient::Middleware::ParseJson, FaradayMiddleware::Gzip, ElastomerClient::Middleware::EncodeJson, ElastomerClient::Middleware::LimitSize, Faraday::Adapter::Test]>
```

After:

```
<Faraday::RackBuilder:0x00000001226b8e38 @adapter=Faraday::Adapter::Test, @handlers=[ElastomerClient::Middleware::ParseJson, FaradayMiddleware::Gzip, ElastomerClient::Middleware::EncodeJson, ElastomerClient::Middleware::LimitSize]>
```

So this commit updates these tests to check that we're using the right
adapter instead of checking that the adapter is in the list of handlers.
  • Loading branch information
composerinteralia committed Jun 5, 2024
1 parent d0164d7 commit e7470aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
it "uses the adapter specified at creation" do
c = ElastomerClient::Client.new(adapter: :test)

assert_includes c.connection.builder.handlers, Faraday::Adapter::Test
assert_equal c.connection.builder.adapter, Faraday::Adapter::Test
end

it "allows configuring the Faraday when a block is given" do
Expand All @@ -28,7 +28,7 @@
c = ElastomerClient::Client.new
adapter = Faraday::Adapter.lookup_middleware(Faraday.default_adapter)

assert_includes c.connection.builder.handlers, adapter
assert_equal c.connection.builder.adapter, adapter
end

it "uses the same connection for all requests" do
Expand Down

0 comments on commit e7470aa

Please sign in to comment.