Class: Gurke::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/gurke/step.rb

Defined Under Namespace

Classes: StepResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, line, type, raw) ⇒ Step

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Step.



24
25
26
27
28
29
# File 'lib/gurke/step.rb', line 24

def initialize(file, line, type, raw)
  @file = file
  @line = line
  @type = type
  @raw = raw
end

Instance Attribute Details

#fileString (readonly)

Return path to file containing this scenario.

Returns:

  • (String)

    File path.



10
11
12
# File 'lib/gurke/step.rb', line 10

def file
  @file
end

#lineFixnum (readonly)

Return line number where the scenario is defined.

Returns:

  • (Fixnum)

    Line number.



16
17
18
# File 'lib/gurke/step.rb', line 16

def line
  @line
end

#rawObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
# File 'lib/gurke/step.rb', line 21

def raw
  @raw
end

#typeObject (readonly)

Returns the value of attribute type.



18
19
20
# File 'lib/gurke/step.rb', line 18

def type
  @type
end

Instance Method Details

#doc_stringObject



40
41
42
# File 'lib/gurke/step.rb', line 40

def doc_string
  raw.doc_string&.value
end

#keywordObject



36
37
38
# File 'lib/gurke/step.rb', line 36

def keyword
  raw.keyword.strip
end

#nameObject Also known as: to_s



31
32
33
# File 'lib/gurke/step.rb', line 31

def name
  raw.name
end

#run(runner, reporter, scenario, world) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
49
50
51
52
# File 'lib/gurke/step.rb', line 46

def run(runner, reporter, scenario, world)
  reporter.invoke :before_step, self, scenario

  run_step(runner, reporter, scenario, world).tap do |result|
    reporter.invoke :after_step, result, scenario
  end
end