Class: Cucumberator::CurrentStep

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumberator/current_step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment) ⇒ CurrentStep

Returns a new instance of CurrentStep.



7
8
9
10
11
12
# File 'lib/cucumberator/current_step.rb', line 7

def initialize(environment)
  @environment = environment
  @scenario_sexp = steps.to_sexp
  @offset = 0
  set_line
end

Instance Attribute Details

#lineObject

Returns the value of attribute line.



5
6
7
# File 'lib/cucumberator/current_step.rb', line 5

def line
  @line
end

Instance Method Details

#check_for_scenario_outline!Object



14
15
16
17
18
# File 'lib/cucumberator/current_step.rb', line 14

def check_for_scenario_outline!
  return unless @environment.respond_to?(:scenario_outline)

  @environment = @environment.scenario_outline
end

#increaseObject



25
26
27
28
# File 'lib/cucumberator/current_step.rb', line 25

def increase
  @offset += 1
  set_line
end

#set_lineObject



30
31
32
33
# File 'lib/cucumberator/current_step.rb', line 30

def set_line
  current_sexp = @scenario_sexp[@offset]
  self.line = Cucumberator::StepLine.new(current_sexp[1]) if current_sexp
end

#stepsObject



20
21
22
23
# File 'lib/cucumberator/current_step.rb', line 20

def steps
  check_for_scenario_outline!
  @environment.instance_variable_get(:@steps)
end