Class: Cucumber::Formatter::LegacyApi::Results

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/formatter/legacy_api/results.rb

Instance Method Summary collapse

Constructor Details

#initializeResults

Returns a new instance of Results



7
8
9
10
11
# File 'lib/cucumber/formatter/legacy_api/results.rb', line 7

def initialize
  # Optimization - quicker lookup.
  @inserted_steps = {}
  @inserted_scenarios = {}
end

Instance Method Details

#scenario_visited(scenario) ⇒ Object

:nodoc:



21
22
23
24
25
26
27
# File 'lib/cucumber/formatter/legacy_api/results.rb', line 21

def scenario_visited(scenario) #:nodoc:
  scenario_id = scenario.object_id

  return if @inserted_scenarios.key?(scenario_id)
  @inserted_scenarios[scenario_id] = scenario
  scenarios.push(scenario)
end

#scenarios(status = nil) ⇒ Object

:nodoc:



38
39
40
41
42
43
44
45
# File 'lib/cucumber/formatter/legacy_api/results.rb', line 38

def scenarios(status = nil) #:nodoc:
  @scenarios ||= []
  if(status)
    @scenarios.select{|scenario| scenario.status == status}
  else
    @scenarios
  end
end

#step_visited(step) ⇒ Object

:nodoc:



13
14
15
16
17
18
19
# File 'lib/cucumber/formatter/legacy_api/results.rb', line 13

def step_visited(step) #:nodoc:
  step_id = step.object_id

  return if @inserted_steps.key?(step_id)
  @inserted_steps[step_id] = step
  steps.push(step)
end

#steps(status = nil) ⇒ Object

:nodoc:



29
30
31
32
33
34
35
36
# File 'lib/cucumber/formatter/legacy_api/results.rb', line 29

def steps(status = nil) #:nodoc:
  @steps ||= []
  if(status)
    @steps.select{|step| step.status == status}
  else
    @steps
  end
end