class Computering::Dsl::Spec

Public Class Methods

from_block(name, text, &block) click to toggle source
# File lib/computering/dsl/spec.rb, line 18
def self.from_block(name, text, &block)
  Array(self.new name, text, &block)
end
new(name, text, &block) click to toggle source
Calls superclass method
# File lib/computering/dsl/spec.rb, line 22
def initialize(name, text, &block)
  super text
  @name   = name
  @block  = block
  @buffer = "\n"
end

Public Instance Methods

execute() click to toggle source
# File lib/computering/dsl/spec.rb, line 29
def execute
  describe @name, &@block

  output    = StringIO.new("")
  reporter  = Minitest::SummaryReporter.new(output)

  reporter.start

  Minitest::Runnable.runnables.each do |runnable|
    runnable.run reporter
  end

  reporter.report

  @buffer << output.string.strip
  Minitest::Test.reset
rescue
  @buffer << add_style($!.message, :error)
end