Class: Mocktail::MakesDouble
- Inherits:
-
Object
- Object
- Mocktail::MakesDouble
- Extended by:
- T::Sig
- Defined in:
- lib/mocktail/imitates_type/makes_double.rb,
lib/mocktail/sorbet/mocktail/imitates_type/makes_double.rb
Instance Method Summary collapse
-
#initialize ⇒ MakesDouble
constructor
A new instance of MakesDouble.
- #make(type) ⇒ Object
Constructor Details
#initialize ⇒ MakesDouble
Returns a new instance of MakesDouble.
8 9 10 11 |
# File 'lib/mocktail/imitates_type/makes_double.rb', line 8 def initialize @declares_dry_class = DeclaresDryClass.new @gathers_fakeable_instance_methods = GathersFakeableInstanceMethods.new end |
Instance Method Details
#make(type) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mocktail/imitates_type/makes_double.rb', line 13 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 |