Module: Bacon::Bits

Defined in:
lib/bacon/bits.rb

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object

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



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bacon/bits.rb', line 10

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

Instance Method Details

#after_allObject



28
# File 'lib/bacon/bits.rb', line 28

def after_all; yield; end

#assert(description, &block) ⇒ Object



29
30
31
32
33
# File 'lib/bacon/bits.rb', line 29

def assert(description, &block)
  it(description) do
    block.call.should == true
  end
end

#before_allObject



27
# File 'lib/bacon/bits.rb', line 27

def before_all; yield; end

#xdescribe(*args) ⇒ Object



26
# File 'lib/bacon/bits.rb', line 26

def xdescribe(*args); end

#xit(*args) ⇒ Object



25
# File 'lib/bacon/bits.rb', line 25

def xit(*args); end