Sha256: d4e9c62fe8ff0c6430a4b140b7da0e46bc9b2dd824a22cfca5d159989696d1ab

Contents?: true

Size: 766 Bytes

Versions: 5

Compression:

Stored size: 766 Bytes

Contents

module BaconExtensions
  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

  def xit(*args); end
  def xdescribe(*args); end
  def before_all; yield; end
  def after_all; yield; end
  def assert(description, &block)
    it(description) do
      block.call.should == true
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
boson-0.2.5 test/bacon_extensions.rb
boson-0.2.4 test/bacon_extensions.rb
bond-0.2.1 test/bacon_extensions.rb
hirb-0.3.2 test/bacon_extensions.rb
bond-0.2.0 test/bacon_extensions.rb