the class methods of this intercepting object
the class methods of this intercepting object
Verifies whether the specified event was raised
You will probably be using this method only when you’re interested in whether an event has been raised during the course of the test you’re running.
# File lib/caricature/clr/isolator.rb, line 37 37: def did_raise_event?(event_name, &b) 38: isolation_context.verify_event_raise event_name, :class, &b 39: end
Verifies whether the specified method has been called You can specify constraints in the block
The most complex configuration you can make currently is one that is constrained by arguments. This is most likely to be extended in the future to allow for more complex verifications.
Example:
an_isolation.class.did_receive?(:a_method) do |method_call| method_call.with(3, "a") end.should.be.successful
is equivalent to:
an_isolation.class.did_receive?(:a_method).with(3, "a").should.be.successful
You will probably be using this method only when you’re interested in whether a method has been called during the course of the test you’re running.
# File lib/caricature/isolator.rb, line 58 58: def did_receive?(method_name, &block) 59: isolation_context.class_verify method_name, &block 60: end
the context of this isolation instance. this context takes care of responding to method calls etc.
# File lib/caricature/isolator.rb, line 17 17: def isolation_context 18: @___context___ 19: end
Raises an event on the isolation You can specify the arguments in the block or as parameters
Example
an_isolation.class.raise_event :on_property_changed do |raiser| raiser.with an_isolation, System::EventArgs.empty end
is equivalent to:
an_isolation.class.raise_event :on_property_changed, an_isolation, System::EventArgs.empty
or
an_isolation.class.raise_event(:on_property_changed).with(an_isolation, System::EventArgs.empty)
You will most likely use this method when you want to verify logic in an event handler You will most likely use this method when you want to verify logic in an event handler
# File lib/caricature/clr/isolator.rb, line 29 29: def raise_event(event_name, *args, &block) 30: isolation_context.add_event_expectation event_name, :class, *args, &block 31: end
Replaces the call to the proxy with the one you create with this method. You can specify more specific criteria in the block to configure the expectation.
Example:
an_isolation.class.when_receiving(:a_method) do |method_call| method_call.with(3, "a").return(5) end
is equivalent to:
an_isolation.class.when_receiving(:a_method).with(3, "a").return(5)
You will most likely use this method when you want your stubs to return something else than nil when they get called during the run of the test they are defined in.
# File lib/caricature/isolator.rb, line 36 36: def when_receiving(method_name, &block) 37: isolation_context.create_class_override method_name, &block 38: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.