Double#any_number_of_times sets an that the Double will be called any number of times. This effectively removes the times called expectation from the Doublen
Passing in a block sets the return value.
mock(subject).method_name.any_number_of_times
# File lib/rr/double_definitions/double_definition.rb, line 163
163: def any_number_of_times(&return_value_block)
164: @times_matcher = TimesCalledMatchers::AnyTimesMatcher.new
165: install_method_callback return_value_block
166: self
167: end
Double#at_least sets the expectation that the Double will be called at least n times. It works by creating a TimesCalledExpectation.
Passing in a block sets the return value.
mock(subject).method_name.at_least(4) {:return_value}
# File lib/rr/double_definitions/double_definition.rb, line 137
137: def at_least(number, &return_value_block)
138: @times_matcher = TimesCalledMatchers::AtLeastMatcher.new(number)
139: install_method_callback return_value_block
140: self
141: end
Double#at_most allows sets the expectation that the Double will be called at most n times. It works by creating a TimesCalledExpectation.
Passing in a block sets the return value.
mock(subject).method_name.at_most(4) {:return_value}
# File lib/rr/double_definitions/double_definition.rb, line 150
150: def at_most(number, &return_value_block)
151: @times_matcher = TimesCalledMatchers::AtMostMatcher.new(number)
152: install_method_callback return_value_block
153: self
154: end
Double#never sets the expectation that the Double will never be called.
This method does not accept a block because it will never be called.
mock(subject).method_name.never
# File lib/rr/double_definitions/double_definition.rb, line 101
101: def never
102: @times_matcher = TimesCalledMatchers::NeverMatcher.new
103: self
104: end
Double#once sets the expectation that the Double will be called 1 time.
Passing in a block sets the return value.
mock(subject).method_name.once {:return_value}
# File lib/rr/double_definitions/double_definition.rb, line 112
112: def once(&return_value_block)
113: @times_matcher = TimesCalledMatchers::IntegerMatcher.new(1)
114: install_method_callback return_value_block
115: self
116: end
Double#times creates an TimesCalledExpectation of the passed in number.
Passing in a block sets the return value.
mock(subject).method_name.times(4) {:return_value}
# File lib/rr/double_definitions/double_definition.rb, line 176
176: def times(matcher_value, &return_value_block)
177: @times_matcher = TimesCalledMatchers::TimesCalledMatcher.create(matcher_value)
178: install_method_callback return_value_block
179: self
180: end
Double#twice sets the expectation that the Double will be called 2 times.
Passing in a block sets the return value.
mock(subject).method_name.twice {:return_value}
# File lib/rr/double_definitions/double_definition.rb, line 124
124: def twice(&return_value_block)
125: @times_matcher = TimesCalledMatchers::IntegerMatcher.new(2)
126: install_method_callback return_value_block
127: self
128: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.