Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
in 1.8.7, Object#methods returns an array of strings
Browse files Browse the repository at this point in the history
Luckily, we already have some code in this very file that handles that
situation, so we can just ride along.
  • Loading branch information
nevinera committed May 9, 2024
1 parent 8d0ae41 commit 7a56da1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/rspec/matchers/built_in/has.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def description
# queries `has_receiveddd?`, the spy _fakes_ the method, returning its (truthy) self.
def really_responds_to?(method)
if defined?(RSpec::Mocks::Double) && @actual.is_a?(RSpec::Mocks::Double)
@actual.respond_to?(method) && @actual.methods.include?(method)
@actual.respond_to?(method) && methods_include?(method)
else
@actual.respond_to?(method)
end
Expand All @@ -70,11 +70,19 @@ def predicate_accessible?
def private_predicate?
@actual.private_methods.include? predicate.to_s
end

def methods_include?(method)
@actual.methods.include?(method.to_s)
end
# :nocov:
else
def private_predicate?
@actual.private_methods.include? predicate
end

def methods_include?(method)
@actual.methods.include?(method)
end
end

def predicate_result
Expand Down

0 comments on commit 7a56da1

Please sign in to comment.