mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-15 00:01:36 -04:00
fix Builder::Handler comparison to another Handler
This commit is contained in:
parent
accd07fa20
commit
f7e80bf4ce
@ -34,7 +34,9 @@ module Faraday
|
||||
def inspect() @name end
|
||||
|
||||
def ==(other)
|
||||
if other.respond_to? :name
|
||||
if other.is_a? Handler
|
||||
self.name == other.name
|
||||
elsif other.respond_to? :name
|
||||
klass == other
|
||||
else
|
||||
@name == other.to_s
|
||||
|
@ -87,6 +87,13 @@ class MiddlewareStackTest < Faraday::TestCase
|
||||
assert !duped_connection.builder.locked?
|
||||
end
|
||||
|
||||
def test_handler_comparison
|
||||
build_stack Apple
|
||||
assert_equal @builder.handlers.first, Apple
|
||||
assert_equal @builder.handlers[0,1], [Apple]
|
||||
assert_equal @builder.handlers.first, Faraday::Builder::Handler.new(Apple)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# make a stack with test adapter that reflects the order of middleware
|
||||
|
Loading…
x
Reference in New Issue
Block a user