Sha256: 912fba2d158c7702b2c40e133f05121f0cd58eb3c14f6ef5a949448ebb441b2c

Contents?: true

Size: 737 Bytes

Versions: 6

Compression:

Stored size: 737 Bytes

Contents

module Shoulda
  module Matchers
    module Doublespeak
      # @private
      class ObjectDouble < BasicObject
        attr_reader :calls

        def initialize
          @calls = []
          @calls_by_method_name = {}
        end

        def calls_to(method_name)
          @calls_by_method_name[method_name] || []
        end

        def respond_to?(name, include_private = nil)
          true
        end

        def method_missing(method_name, *args, &block)
          calls << MethodCallWithName.new(method_name, args, block)
          (calls_by_method_name[method_name] ||= []) << MethodCall.new(args, block)
          nil
        end

        protected

        attr_reader :calls_by_method_name
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-matchers-2.8.0/lib/shoulda/matchers/doublespeak/object_double.rb
shoulda-matchers-2.8.0 lib/shoulda/matchers/doublespeak/object_double.rb
shoulda-matchers-2.8.0.rc2 lib/shoulda/matchers/doublespeak/object_double.rb
shoulda-matchers-2.8.0.rc1 lib/shoulda/matchers/doublespeak/object_double.rb
shoulda-matchers-2.7.0 lib/shoulda/matchers/doublespeak/object_double.rb
shoulda-matchers-2.6.2 lib/shoulda/matchers/doublespeak/object_double.rb