You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Method Savon::Response#hash is returning a result of Nori parse. hash is a special Ruby method and should almost never be overriden (unless for matching override of == method in which case it has to return a number). This can lead to a number of unexpected issues, one of which is explained below.
Steps to reproduce current behavior:
Having following module stub:
module MonitorStub
def self.call(response:, other_arg:)
end
end
The test is expected to fail due to other_arg mismatch, however rspec is unable to generate the failure message as it tries to count call by arguments. It does it by all_call_args.group_by(&:itself).map {|args, calls| [args, calls.count]}. and since savon_response_object.hash returns instance of Hash rather than number, it cannot be part of hash key, leading to:
*** TypeError Exception: no implicit conversion of Hash into Integer
Expected behavior:
I'd expect to see correct matcher failure message.
The only step required to fix this and potentially number of other issues is to rename Savon::Response#hash to nori_hash or parsed_response.
System information:
ruby version: 2.7.2p137
savon version: 2.12.1
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Bug report
Method
Savon::Response#hash
is returning a result of Nori parse.hash
is a special Ruby method and should almost never be overriden (unless for matching override of==
method in which case it has to return a number). This can lead to a number of unexpected issues, one of which is explained below.Steps to reproduce current behavior:
Having following module stub:
and following rspec test stub:
The test is expected to fail due to other_arg mismatch, however rspec is unable to generate the failure message as it tries to count call by arguments. It does it by
all_call_args.group_by(&:itself).map {|args, calls| [args, calls.count]}.
and sincesavon_response_object.hash
returns instance of Hash rather than number, it cannot be part of hash key, leading to:Expected behavior:
I'd expect to see correct matcher failure message.
The only step required to fix this and potentially number of other issues is to rename
Savon::Response#hash
tonori_hash
orparsed_response
.System information:
The text was updated successfully, but these errors were encountered: