Class: Mocktail::ImitatesType

Inherits:
Object
  • Object
show all
Extended by:
T::Generic, T::Sig
Defined in:
lib/mocktail/imitates_type.rb,
lib/mocktail/sorbet/mocktail/imitates_type.rb

Instance Method Summary collapse

Constructor Details

#initializeImitatesType

Returns a new instance of ImitatesType.



9
10
11
12
# File 'lib/mocktail/imitates_type.rb', line 9

def initialize
  @ensures_imitation_support = EnsuresImitationSupport.new
  @makes_double = MakesDouble.new
end

Instance Method Details

#imitate(type) ⇒ Object



14
15
16
17
18
19
# File 'lib/mocktail/imitates_type.rb', line 14

def imitate(type)
  @ensures_imitation_support.ensure(type)
  @makes_double.make(type).tap do |double|
    Mocktail.cabinet.store_double(double)
  end.dry_instance
end