lib/caricature/isolation.rb in caricature-0.7.0 vs lib/caricature/isolation.rb in caricature-0.7.1

- old
+ new

@@ -62,28 +62,26 @@ attr_reader :expectations # Initializes a new instance of this isolation. def initialize(isolator, context) @instance = isolator.subject - @recorder = context.recorder @messenger = context.messenger - @expectations = context.expectations + @messenger.recorder = @recorder = context.recorder + @expectations = context.expectations @proxy = isolator.isolation isolator.isolation.class.instance_variable_set("@___context___", self) end # record and send the message to the isolation. # takes care of following expectations rules when sending messages. def send_message(method_name, return_type, *args, &b) - recorder.record_call method_name, :instance, *args, &b @messenger.deliver(method_name, return_type, *args, &b) end # record and send the message to the isolation. # takes care of following expectations rules when sending messages. def send_class_message(method_name, return_type, *args, &b) - recorder.record_call method_name, :class, *args, &b @messenger.deliver_to_class(method_name, return_type, *args, &b) end # builds up an expectation for an instance method, allows for overriding the result returned by the method def create_override(method_name, &block) @@ -124,14 +122,9 @@ def internal_create_override(method_name, mode=:instance, &block) builder = ExpectationBuilder.new method_name block.call builder unless block.nil? exp = builder.build - @proxy.class.send((mode == :instance ? :define_method : :define_cmethod), method_name.to_sym, lambda do |*args| - b = nil - b = Proc.new { yield } if block_given? - isolation_context.send_message(method_name, nil, *args, &b) - end) expectations.add_expectation exp, mode exp end def internal_verify(method_name, mode=:instance, &block) \ No newline at end of file