In Files

Parent

Namespace

Class Index [+]

Quicksearch

RR::Space

RR::Space.instance is the global state subject for the RR framework.

Attributes

instance[W]
ordered_doubles[R]
recorded_calls[R]
trim_backtrace[RW]

Public Class Methods

instance() click to toggle source
    # File lib/rr/space.rb, line 11
11:       def instance
12:         @instance ||= new
13:       end
new() click to toggle source
    # File lib/rr/space.rb, line 24
24:     def initialize
25:       @ordered_doubles = []
26:       @trim_backtrace = false
27:       @recorded_calls = RR::RecordedCalls.new
28:     end

Protected Class Methods

method_missing(method_name, *args, &block) click to toggle source
    # File lib/rr/space.rb, line 17
17:       def method_missing(method_name, *args, &block)
18:         instance.__send__(method_name, *args, &block)
19:       end

Public Instance Methods

blank_slate_whitelist() click to toggle source
    # 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
record_call(subject, method_name, arguments, block) click to toggle source
    # 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
register_ordered_double(double) click to toggle source

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
reset() click to toggle source

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
reset_double(subject, method_name) click to toggle source

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
verify(*subjects) click to toggle source
Alias for: verify_doubles
verify_double(subject, method_name) click to toggle source

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
verify_doubles(*subjects) click to toggle source

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
Also aliased as: verify
verify_ordered_double(double) click to toggle source

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

Protected Instance Methods

reset_method_missing_injections() click to toggle source
    # 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
reset_ordered_doubles() click to toggle source

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
reset_recorded_calls() click to toggle source
     # File lib/rr/space.rb, line 108
108:     def reset_recorded_calls
109:       @recorded_calls.clear
110:     end
reset_singleton_method_added_injections() click to toggle source
     # 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.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.