Object
RR::Space.instance is the global state subject for the RR framework.
# File lib/rr/space.rb, line 86 def blank_slate_whitelist @blank_slate_whitelist ||= [ "object_id", "respond_to?", "respond_to_missing?", "method_missing", "instance_eval", "instance_exec", "class_eval" ] end
# File lib/rr/space.rb, line 82 def record_call(subject, method_name, arguments, block) @recorded_calls << [subject, method_name, arguments, block] end
Registers the ordered Double to be verified.
# File lib/rr/space.rb, line 32 def register_ordered_double(double) @ordered_doubles << double unless ordered_doubles.include?(double) end
Resets the registered Doubles and ordered Doubles
# File lib/rr/space.rb, line 61 def reset RR.trim_backtrace = false RR.overridden_error_class = nil reset_ordered_doubles Injections::DoubleInjection.reset reset_method_missing_injections reset_singleton_method_added_injections reset_recorded_calls reset_bound_objects end
Resets the DoubleInjection for the passed in subject and method_name.
# File lib/rr/space.rb, line 78 def reset_double(subject, method_name) Injections::DoubleInjection.reset_double(class << subject; self; end, method_name) end
Verifies the DoubleInjection for the passed in subject and method_name.
# File lib/rr/space.rb, line 73 def verify_double(subject, method_name) Injections::DoubleInjection.verify_double(class << subject; self; end, method_name) end
Verifies all the DoubleInjection objects have met their TimesCalledExpectations.
# File lib/rr/space.rb, line 55 def verify_doubles(*subjects) Injections::DoubleInjection.verify(*subjects) end
Verifies that the passed in ordered Double is being called in the correct position.
# File lib/rr/space.rb, line 38 def verify_ordered_double(double) unless double.terminal? raise RR::Errors.build_error(:DoubleOrderError, "Ordered Doubles cannot have a NonTerminal TimesCalledExpectation") end unless @ordered_doubles.first == double message = Double.formatted_name(double.method_name, double.expected_arguments) message << " called out of order in list\n" message << Double.list_message_part(@ordered_doubles) raise RR::Errors.build_error(:DoubleOrderError, message) end @ordered_doubles.shift unless double.attempt? double end
# File lib/rr/space.rb, line 116 def reset_bound_objects # TODO: Figure out how to clear and reset these bindings #RR::Injections::DoubleInjection::BoundObjects.clear #RR::Injections::DoubleInjection::MethodMissingInjection.clear end
# File lib/rr/space.rb, line 98 def reset_method_missing_injections Injections::MethodMissingInjection.instances.each do |subject_class, injection| injection.reset end Injections::MethodMissingInjection.instances.clear end
Removes the ordered Doubles from the list
# File lib/rr/space.rb, line 94 def reset_ordered_doubles @ordered_doubles.clear end
# File lib/rr/space.rb, line 112 def reset_recorded_calls @recorded_calls.clear end
# File lib/rr/space.rb, line 105 def reset_singleton_method_added_injections Injections::SingletonMethodAddedInjection.instances.each do |subject, injection| injection.reset end Injections::SingletonMethodAddedInjection.instances.clear end
Generated with the Darkfish Rdoc Generator 2.