Class Index [+]

Quicksearch

Spec::Mocks::MessageExpectation

Public Instance Methods

advise(args, block) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 242
242:       def advise(args, block)
243:         similar_messages << args
244:       end
any_number_of_times(&block) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 279
279:       def any_number_of_times(&block)
280:         @method_block = block if block
281:         @expected_received_count = :any
282:         self
283:       end
at_least(n) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 264
264:       def at_least(n)
265:         set_expected_received_count :at_least, n
266:         self
267:       end
at_most(n) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 269
269:       def at_most(n)
270:         set_expected_received_count :at_most, n
271:         self
272:       end
exactly(n) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 259
259:       def exactly(n)
260:         set_expected_received_count :exactly, n
261:         self
262:       end
expected_messages_received?() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 217
217:       def expected_messages_received?
218:         ignoring_args? || matches_exact_count? ||
219:            matches_at_least_count? || matches_at_most_count?
220:       end
generate_error() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 246
246:       def generate_error
247:         if similar_messages.empty?
248:           @error_generator.raise_expectation_error(@sym, @expected_received_count, @actual_received_count, *@args_expectation.args)
249:         else
250:           @error_generator.raise_unexpected_message_args_error(self, *@similar_messages)
251:         end
252:       end
ignoring_args?() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 222
222:       def ignoring_args?
223:         @expected_received_count == :any
224:       end
matches_at_least_count?() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 226
226:       def matches_at_least_count?
227:         @at_least && @actual_received_count >= @expected_received_count
228:       end
matches_at_most_count?() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 230
230:       def matches_at_most_count?
231:         @at_most && @actual_received_count <= @expected_received_count
232:       end
matches_exact_count?() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 234
234:       def matches_exact_count?
235:         @expected_received_count == @actual_received_count
236:       end
matches_name?(sym) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 200
200:       def matches_name?(sym)
201:         @sym == sym
202:       end
matches_name_but_not_args(sym, args) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 204
204:       def matches_name_but_not_args(sym, args)
205:         matches_name?(sym) and not @args_expectation.args_match?(args)
206:       end
negative_expectation_for?(sym) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 309
309:       def negative_expectation_for?(sym)
310:         return false
311:       end
never() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 285
285:       def never
286:         @expected_received_count = 0
287:         self
288:       end
once(&block) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 290
290:       def once(&block)
291:         @method_block = block if block
292:         @expected_received_count = 1
293:         self
294:       end
ordered(&block) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 302
302:       def ordered(&block)
303:         @method_block = block if block
304:         @order_group.register(self)
305:         @ordered = true
306:         self
307:       end
similar_messages() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 238
238:       def similar_messages
239:         @similar_messages ||= []
240:       end
times(&block) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 274
274:       def times(&block)
275:         @method_block = block if block
276:         self
277:       end
twice(&block) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 296
296:       def twice(&block)
297:         @method_block = block if block
298:         @expected_received_count = 2
299:         self
300:       end
verify_messages_received() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 208
208:       def verify_messages_received
209:         return if expected_messages_received? || failed_fast?
210: 
211:         generate_error
212:       rescue Spec::Mocks::MockExpectationError => error
213:         error.backtrace.insert(0, @expected_from)
214:         Kernel::raise error
215:       end
with(*args, &block) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 254
254:       def with(*args, &block)
255:         @args_expectation = ArgumentExpectation.new(args, &block)
256:         self
257:       end

Protected Instance Methods

clear_actual_received_count!() click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 327
327:         def clear_actual_received_count!
328:           @actual_received_count = 0
329:         end
set_expected_received_count(relativity, n) click to toggle source
     # File lib/spec/mocks/message_expectation.rb, line 314
314:         def set_expected_received_count(relativity, n)
315:           @at_least = (relativity == :at_least)
316:           @at_most = (relativity == :at_most)
317:           @expected_received_count = case n
318:             when Numeric
319:               n
320:             when :once
321:               1
322:             when :twice
323:               2
324:           end
325:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.