RR::Space.instance is the global state subject for the RR framework.
# File lib/rr/space.rb, line 82 def blank_slate_whitelist @blank_slate_whitelist ||= [ "object_id", "respond_to?", "method_missing", "instance_eval", "instance_exec", "class_eval" ] end
# File lib/rr/space.rb, line 78 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 31 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 60 def reset reset_ordered_doubles Injections::DoubleInjection.reset reset_method_missing_injections reset_singleton_method_added_injections reset_recorded_calls end
Resets the DoubleInjection for the passed in subject and method_name.
# File lib/rr/space.rb, line 74 def reset_double(subject, method_name) Injections::DoubleInjection.reset_double(subject, method_name) end
Verifies the DoubleInjection for the passed in subject and method_name.
# File lib/rr/space.rb, line 69 def verify_double(subject, method_name) Injections::DoubleInjection.verify_double(subject, method_name) end
Verifies all the DoubleInjection objects have met their TimesCalledExpectations.
# File lib/rr/space.rb, line 54 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 37 def verify_ordered_double(double) unless double.terminal? raise Errors::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 Errors::DoubleOrderError, message end @ordered_doubles.shift unless double.attempt? double end
# File lib/rr/space.rb, line 94 def reset_method_missing_injections Injections::MethodMissingInjection.instances.each do |subject, injection| injection.reset end Injections::MethodMissingInjection.instances.clear end
Removes the ordered Doubles from the list
# File lib/rr/space.rb, line 90 def reset_ordered_doubles @ordered_doubles.clear end
# File lib/rr/space.rb, line 108 def reset_recorded_calls @recorded_calls.clear end
# File lib/rr/space.rb, line 101 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.