A base class for Isolator objects to stick with the Isolation nomenclature the strategies for creating isolations are called isolators. An isolator functions as a barrier between the code in your test and the underlying type/instance. It allows you to take control over the value that is returned from a specific method, if you want to pass the method call along to the underlying instance etc. It also contains the ability to verify if a method was called, with which arguments etc.
Creates the actual proxy object for the subject and initializes it with a recorder and expectations This is the actual isolation that will be used to in your tests. It implements all the methods of the subject so as long as you’re in Ruby and just need to isolate out some classes defined in a statically compiled language it should get you all the way there for public instance methods at this point. when you’re going to isolation for usage within a statically compiled language type then you’re bound to most of their rules. So you need to either isolate interfaces or mark the methods you want to isolate as virtual in your implementing classes.
# File lib/caricature/isolator.rb, line 219 def for(context) context.recorder ||= MethodCallRecorder.new context.expectations ||= Expectations.new new(context) end
builds up the isolation class instance
# File lib/caricature/isolator.rb, line 182 def build_isolation(klass, inst=nil) pxy = create_isolation_for klass @isolation = pxy.new @subject = inst initialize_messenger end
Creates the new class name for the isolation
# File lib/caricature/isolator.rb, line 195 def class_name(subj) nm = subj.respond_to?(:class_eval) ? subj.demodulize : subj.class.demodulize @class_name = "#{nm}#{System::Guid.new_guid.to_string('n')}" @class_name end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.