Sha256: 2d76230d031b5d937c5ac6b79f9bd54dc327195919f691ee0d4d07f21bc19ffb

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

require_relative "makes_double/declares_dry_class"
require_relative "makes_double/gathers_fakeable_instance_methods"

module Mocktail
  class MakesDouble
    extend T::Sig

    def initialize
      @declares_dry_class = DeclaresDryClass.new
      @gathers_fakeable_instance_methods = GathersFakeableInstanceMethods.new
    end

    def make(type)
      dry_methods = @gathers_fakeable_instance_methods.gather(type)
      dry_type = @declares_dry_class.declare(type, dry_methods)

      Double.new(
        original_type: type,
        dry_type: dry_type,
        dry_instance: dry_type.new,
        dry_methods: dry_methods
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mocktail-2.0.0 lib/mocktail/imitates_type/makes_double.rb