Any method call may mutate an object, so we can't safely call anything on a passed argument. This reverts the following PRs and commits: * #871: * 8a0962a ("Reword comment to not use “external” twice.") * 52c69f1 ("Just use `Array#hash`.") * #868: * ed3fb3b ("Provide a clear error when received message args are mutated.") * fc9e9a5 ("Ignore arg mutations for method calls we are not concerned with.") This adds notes to the docs about using mutated args with `have_received(…).with(…)`. Fixes #892.
The unimplemented error message gives no indication of whether the object is a class or instance double. This change passes that object to the error generator so that it can create a more specific message depending on whether it is an instance or class double. It defaults to the original "<object> does not implement <method>" for anything else. #838
ErrorGenerator#actual_method_call_args_description and ErrorGenerator#expected_method_call_args_description were almost identical. This change moves the common code from both into the ErrorGenerator#method_call_args_description method and yields to a block which lets the caller decide on what condition to show the formatted args.