RR::Space.instance is the global state subject for the RR framework.
# File lib/rr/space.rb, line 82 82: def blank_slate_whitelist 83: @blank_slate_whitelist ||= [ 84: "object_id", "respond_to?", "method_missing", "instance_eval", "instance_exec", "class_eval" 85: ] 86: end
# File lib/rr/space.rb, line 78 78: def record_call(subject, method_name, arguments, block) 79: @recorded_calls << [subject, method_name, arguments, block] 80: end
Registers the ordered Double to be verified.
# File lib/rr/space.rb, line 31 31: def register_ordered_double(double) 32: @ordered_doubles << double unless ordered_doubles.include?(double) 33: end
Resets the registered Doubles and ordered Doubles
# File lib/rr/space.rb, line 60 60: def reset 61: reset_ordered_doubles 62: Injections::DoubleInjection.reset 63: reset_method_missing_injections 64: reset_singleton_method_added_injections 65: reset_recorded_calls 66: end
Resets the DoubleInjection for the passed in subject and method_name.
# File lib/rr/space.rb, line 74 74: def reset_double(subject, method_name) 75: Injections::DoubleInjection.reset_double(subject, method_name) 76: end
Verifies the DoubleInjection for the passed in subject and method_name.
# File lib/rr/space.rb, line 69 69: def verify_double(subject, method_name) 70: Injections::DoubleInjection.verify_double(subject, method_name) 71: end
Verifies all the DoubleInjection objects have met their TimesCalledExpectations.
# File lib/rr/space.rb, line 54 54: def verify_doubles(*subjects) 55: Injections::DoubleInjection.verify(*subjects) 56: end
Verifies that the passed in ordered Double is being called in the correct position.
# File lib/rr/space.rb, line 37 37: def verify_ordered_double(double) 38: unless double.terminal? 39: raise Errors::DoubleOrderError, 40: "Ordered Doubles cannot have a NonTerminal TimesCalledExpectation" 41: end 42: unless @ordered_doubles.first == double 43: message = Double.formatted_name(double.method_name, double.expected_arguments) 44: message << " called out of order in list\n" 45: message << Double.list_message_part(@ordered_doubles) 46: raise Errors::DoubleOrderError, message 47: end 48: @ordered_doubles.shift unless double.attempt? 49: double 50: end
# File lib/rr/space.rb, line 94 94: def reset_method_missing_injections 95: Injections::MethodMissingInjection.instances.each do |subject, injection| 96: injection.reset 97: end 98: Injections::MethodMissingInjection.instances.clear 99: end
Removes the ordered Doubles from the list
# File lib/rr/space.rb, line 90 90: def reset_ordered_doubles 91: @ordered_doubles.clear 92: end
# File lib/rr/space.rb, line 108 108: def reset_recorded_calls 109: @recorded_calls.clear 110: end
# File lib/rr/space.rb, line 101 101: def reset_singleton_method_added_injections 102: Injections::SingletonMethodAddedInjection.instances.each do |subject, injection| 103: injection.reset 104: end 105: Injections::SingletonMethodAddedInjection.instances.clear 106: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.