Sha256: 88c8f515af98b7f1eb7ccd3f4ec50606b22127bda798f4adf8961ef62788489b

Contents?: true

Size: 447 Bytes

Versions: 2

Compression:

Stored size: 447 Bytes

Contents

module DeclarativeTests
  def describe(name, &block)
    @context ||= []
    @context.push(name)
    block.call
    @context.pop
  end

  def requires(lib, &block)
    require lib
  rescue LoadError
    warn "#{lib} is not available. Skipping some tests."
  else
    block.call
  end

  def it(name, &block)
    describe(name) do
      define_method("test #{@context.join(' ')}", &block)
    end
  end
end

Shoe::TestCase.extend(DeclarativeTests)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoe-0.7.1 test/support/declarative_tests.rb
shoe-0.7.0 test/support/declarative_tests.rb