Sha256: 00968816c171427cff498c3dfa791b2fd5cc25eefb05a34b9208c1779aba91b6

Contents?: true

Size: 793 Bytes

Versions: 1

Compression:

Stored size: 793 Bytes

Contents

require "petitest/dsl/version"

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-dsl-0.3.0 lib/petitest/dsl.rb