Sha256: 4f43beaf2df70de87e03b1558f490aae7f6114d595680dcf63362d994d5f2541

Contents?: true

Size: 553 Bytes

Versions: 5

Compression:

Stored size: 553 Bytes

Contents

module Mocktail
  module Bind
    def self.call(mock, method_name, *args, **kwargs, &blk)
      if Mocktail.cabinet.double_for_instance(mock)
        Object.instance_method(method_name).bind_call(mock, *args, **kwargs, &blk)
      elsif (type_replacement = TopShelf.instance.type_replacement_if_exists_for(mock)) &&
          (og_method = type_replacement.original_methods&.find { |m| m.name == method_name })
        og_method.call(*args, **kwargs, &blk)
      else
        mock.__send__(method_name, *args, **kwargs, &blk)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mocktail-1.2.3 lib/mocktail/share/bind.rb
mocktail-1.2.2 lib/mocktail/share/bind.rb
mocktail-1.2.1 lib/mocktail/share/bind.rb
mocktail-1.2.0 lib/mocktail/share/bind.rb
mocktail-1.1.3 lib/mocktail/share/bind.rb