module Bacon::Bits

Constants

VERSION

Public Class Methods

included(mod) click to toggle source

Will remove this once the latest bacon (which contains this) is released as a gem

# File lib/bacon/bits.rb, line 9
def self.included(mod)
  mod.module_eval do
    # nested context methods automatically inherit methods from parent contexts
    def describe(*args, &block)
      context = Bacon::Context.new(args.join(' '), &block)
      (parent_context = self).methods(false).each {|e|
        class<<context; self end.send(:define_method, e) {|*args| parent_context.send(e, *args)}
      }
      @before.each { |b| context.before(&b) }
      @after.each { |b| context.after(&b) }
      context.run
    end
  end
end

Public Instance Methods

after_all() { || ... } click to toggle source
# File lib/bacon/bits.rb, line 27
def after_all; yield; end
assert(description, &block) click to toggle source
# File lib/bacon/bits.rb, line 28
def assert(description, &block)
  it(description) do
    block.call.should == true
  end
end
before_all() { || ... } click to toggle source
# File lib/bacon/bits.rb, line 26
def before_all; yield; end
describe(*args, &block) click to toggle source

nested context methods automatically inherit methods from parent contexts

# File lib/bacon/bits.rb, line 12
def describe(*args, &block)
  context = Bacon::Context.new(args.join(' '), &block)
  (parent_context = self).methods(false).each {|e|
    class<<context; self end.send(:define_method, e) {|*args| parent_context.send(e, *args)}
  }
  @before.each { |b| context.before(&b) }
  @after.each { |b| context.after(&b) }
  context.run
end
xdescribe(*args) click to toggle source
# File lib/bacon/bits.rb, line 25
def xdescribe(*args); end
xit(*args) click to toggle source
# File lib/bacon/bits.rb, line 24
def xit(*args); end