Sha256: 34352af8efe3db5de844036a4ebc9925ea08b70731eea8672566b23bac4f4377

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

module Defekt
  class Base
    include Assertions

    def self.before(&block)
      define_method(:before, &block)
    end

    def self.after(&block)
      define_method(:after, &block)
    end

    def self.test(name, &block)
      safe_name = "test_#{name.gsub(/\s+/, '_')}".to_sym
      define_method(safe_name, &block)
    end

    def self.children
      @children ||= []
    end

    def self.descendants
      children + children.flat_map(&:descendants)
    end

    private

    def self.inherited(klass)
      children.push(klass)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
defekt-0.0.7 lib/defekt/base.rb