class Totes::Runner

Public Class Methods

new(specs) click to toggle source
# File lib/totes/runner.rb, line 11
def initialize(specs)
  @specs = specs
  Totes::Reporter.inst.reset
end
specs() click to toggle source
# File lib/totes/runner.rb, line 3
def self.specs
  @specs ||= []
end
start() click to toggle source
# File lib/totes/runner.rb, line 7
def self.start
  new(specs).run
end

Public Instance Methods

run() click to toggle source
# File lib/totes/runner.rb, line 16
def run
  @specs.each { |spec| loop_through spec }
  Totes::Reporter.inst.summary
rescue StandardError => e
  Totes::Backtrace.filter e
  raise e
end

Private Instance Methods

exec(specs) click to toggle source
# File lib/totes/runner.rb, line 33
def exec(specs)
  specs.each do |spec|
    spec.instance_eval &spec.instance_variable_get("@__block")
    exec spec.instance_variable_get("@__specs")
  end
end
loop_through(spec) click to toggle source
# File lib/totes/runner.rb, line 26
def loop_through(spec)
  exec [spec]
rescue Totes::Spec::StartOver => e
  spec.instance_eval { @__count[:queries] = 0; @__specs = [] } # resetting the state
  loop_through(spec)
end