lib/muack/test.rb in muack-1.4.0 vs lib/muack/test.rb in muack-1.5.0

- old
+ new

@@ -1,22 +1,53 @@ require 'pork/auto' require 'muack' -Pork::Executor.__send__(:include, Muack::API) +Pork::Suite.include(Muack::API) -Obj = Object.new -Str = 'Moo' -def Obj.inspect - 'obj' +Str = String.new('Moo') +class Cls + def inspect + 'obj' + end + def aloha a=0, b=1 + [a, b] + end + def bonjour a: 0, b: 1 + [a, b] + end + def ciao h={a: 0, b: 1} + h.values_at(:a, :b) + end + module Prepend + def prepend_aloha a=0, b=1 + [a, b] + end + def prepend_bonjour a: 0, b: 1 + [a, b] + end + def prepend_ciao h={a: 0, b: 1} + h.values_at(:a, :b) + end + end + prepend Prepend end -def Obj.private - 'pri' +Obj = Cls.new +class << Obj + private def private + 'pri' + end + + def single_aloha a=0, b=1 + [a, b] + end + def single_bonjour a: 0, b: 1 + [a, b] + end + def single_ciao h={a: 0, b: 1} + h.values_at(:a, :b) + end end -def Obj.aloha a=0, b=1 - [a, b] -end -Obj.singleton_class.__send__(:private, :private) Muack::EnsureReset = lambda{ [Obj, Str].each do |o| o.methods.select{ |m| m.to_s.start_with?('__muack_mock') || m.to_s.start_with?('say')