Sha256: 3dbc6f75e59306c7f0572ab84516c21d41d15cd76976b50b9a5881e2e22aff21

Contents?: true

Size: 761 Bytes

Versions: 1

Compression:

Stored size: 761 Bytes

Contents

module Petitest
  module DSL
    # @param current_description [String]
    def desc(current_description)
      self.current_description = current_description
    end

    # @param description [String]
    # @param metadata [Hash{Symbol => Object}]
    def sub_test(description, metadata = {}, &block)
      child = ::Class.new(self)
      child.description = description
      child.metadata = self.metadata.merge(metadata)
      child.undefine_test_methods
      child.class_eval(&block)
      child
    end

    # @param description [String]
    # @param metadata [Hash{Symbol => Object}]
    def test(description, metadata = {}, &block)
      block ||= -> { skip }
      desc(description)
      define_method("test_#{description}", &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
petitest-0.3.0 lib/petitest/dsl.rb