class Lucid::ContextLoader::Results

Public Class Methods

new(context) click to toggle source
# File lib/lucid/results.rb, line 5
def initialize(context)
  @context = context
  @inserted_steps = {}
  @inserted_scenarios = {}
end

Public Instance Methods

configure(new_context) click to toggle source
# File lib/lucid/results.rb, line 11
def configure(new_context)
  @context = Context.parse(new_context)
end
failure?() click to toggle source
# File lib/lucid/results.rb, line 51
def failure?
  if @context.wip?
    scenarios(:passed).any?
  else
    scenarios(:failed).any? || steps(:failed).any? ||
    (@context.strict? && (steps(:undefined).any? || steps(:pending).any?))
  end
end
scenario_visited(scenario) click to toggle source
# File lib/lucid/results.rb, line 24
def scenario_visited(scenario)
  scenario_id = scenario.object_id

  unless @inserted_scenarios.has_key?(scenario_id)
    @inserted_scenarios[scenario_id] = scenario
    scenarios.push(scenario)
  end
end
scenarios(status = nil) click to toggle source
# File lib/lucid/results.rb, line 42
def scenarios(status = nil)
  @scenarios ||= []
  if(status)
    @scenarios.select{|scenario| scenario.status == status}
  else
    @scenarios
  end
end
step_visited(step) click to toggle source
# File lib/lucid/results.rb, line 15
def step_visited(step)
  step_id = step.object_id

  unless @inserted_steps.has_key?(step_id)
    @inserted_steps[step_id] = step
    steps.push(step)
  end
end