Add missing ruby2_keywords calls in rspec-mocks
Created by: eregon
- And standardize checks to
if respond_to?(:ruby2_keywords, true)
.
cc @bjfish
This is progress towards https://github.com/rspec/rspec-metagem/issues/68. Before: 25 failures, After: 2 failures left (which seem unrelated):
Failures:
1) #any_instance when stubbing aliased methods tracks aliased method calls
Failure/Error: parent_aliased_method
NameError:
undefined local variable or method `parent_aliased_method' for #<AnyInstanceSpec::ParentClass:0x2bb88>
# ./spec/rspec/mocks/any_instance_spec.rb:20:in `caller_of_parent_aliased_method'
# ./spec/rspec/mocks/any_instance_spec.rb:210:in `block (4 levels) in <module:Mocks>'
2) Marshal extensions #dump when rspec-mocks has been fully initialized applying and unapplying patch is idempotent
Failure/Error: expect { Marshal.dump(obj) }.to raise_error(TypeError)
expected TypeError but nothing was raised
# ./spec/rspec/mocks/marshal_extension_spec.rb:46:in `block (4 levels) in <top (required)>'
BTW, the reason the code worked before these ruby2_keywords
seems accidental and due to a bug/inconsistency in CRuby: https://bugs.ruby-lang.org/issues/18625