lib/rspec/mocks/instance_method_stasher.rb in rspec-mocks-3.0.4 vs lib/rspec/mocks/instance_method_stasher.rb in rspec-mocks-3.1.0

- old
+ new

@@ -51,11 +51,11 @@ !!@original_method end # @private def stash - return if !method_defined_directly_on_klass? + return unless method_defined_directly_on_klass? @original_method ||= ::RSpec::Support.method_handle_for(@object, @method) end # @private def restore @@ -78,13 +78,13 @@ # https://bugs.ruby-lang.org/issues/8686 def handle_restoration_failures yield rescue TypeError RSpec.warn_with( - "RSpec failed to properly restore a partial double (#{@object.inspect}) " + - "to its original state due to a known bug in MRI 2.0.0-p195 & p247 " + - "(https://bugs.ruby-lang.org/issues/8686). This object may remain " + + "RSpec failed to properly restore a partial double (#{@object.inspect}) " \ + "to its original state due to a known bug in MRI 2.0.0-p195 & p247 " \ + "(https://bugs.ruby-lang.org/issues/8686). This object may remain " \ "screwed up for the rest of this process. Please upgrade to 2.0.0-p353 or above.", :call_site => nil, :use_spec_location_as_call_site => true ) end else @@ -100,10 +100,10 @@ def method_defined_directly_on_klass? method_defined_on_klass? && method_owned_by_klass? end # @private - def method_defined_on_klass?(klass = @klass) + def method_defined_on_klass?(klass=@klass) MethodReference.method_defined_at_any_visibility?(klass, @method) end def method_owned_by_klass? owner = @klass.instance_method(@method).owner