In Files

Files

Bacon::TestUnitOutput::TapOutput::Should

Public Class Methods

new(object) click to toggle source
     # File lib/bacon.rb, line 294
294:   def initialize(object)
295:     @object = object
296:     @negated = false
297:   end

Public Instance Methods

a(*args, &block) click to toggle source
Alias for: be
an(*args, &block) click to toggle source
Alias for: be
be(*args, &block) click to toggle source
     # File lib/bacon.rb, line 309
309:   def be(*args, &block)
310:     if args.empty?
311:       self
312:     else
313:       block = args.shift  unless block_given?
314:       satisfy(*args, &block)
315:     end
316:   end
Also aliased as: a, an
equal(value) click to toggle source
     # File lib/bacon.rb, line 346
346:   def equal(value)         self == value      end
flunk(reason="Flunked") click to toggle source
     # File lib/bacon.rb, line 351
351:   def flunk(reason="Flunked")
352:     raise Bacon::Error.new(:failed, reason)
353:   end
identical_to(value) click to toggle source
     # File lib/bacon.rb, line 348
348:   def identical_to(value)  self.equal? value  end
Also aliased as: same_as
match(value) click to toggle source
     # File lib/bacon.rb, line 347
347:   def match(value)         self =~ value      end
method_missing(name, *args, &block) click to toggle source
     # File lib/bacon.rb, line 336
336:   def method_missing(name, *args, &block)
337:     name = "#{name}?"  if name.to_s =~ /\w[^?]\z/
338: 
339:     desc = @negated ? "not " : ""
340:     desc << @object.inspect << "." << name.to_s
341:     desc << "(" << args.map{|x|x.inspect}.join(", ") << ") failed"
342: 
343:     satisfy(desc) { |x| x.__send__(name, *args, &block) }
344:   end
not(*args, &block) click to toggle source
     # File lib/bacon.rb, line 299
299:   def not(*args, &block)
300:     @negated = !@negated
301: 
302:     if args.empty?
303:       self
304:     else
305:       be(*args, &block)
306:     end
307:   end
same_as(value) click to toggle source
Alias for: identical_to
satisfy(*args, &block) click to toggle source
     # File lib/bacon.rb, line 321
321:   def satisfy(*args, &block)
322:     if args.size == 1 && String === args.first
323:       description = args.shift
324:     else
325:       description = ""
326:     end
327: 
328:     r = yield(@object, *args)
329:     if Bacon::Counter[:depth] > 0
330:       Bacon::Counter[:requirements] += 1
331:       raise Bacon::Error.new(:failed, description)  unless @negated ^ r
332:     end
333:     @negated ^ r ? r : false
334:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.