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.



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

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

Instance Attribute Details

#fileString (readonly)

Return path to file containing this scenario.

Returns:

  • (String)

    File path.



8
9
10
# File 'lib/gurke/step.rb', line 8

def file
  @file
end

#lineFixnum (readonly)

Return line number where the scenario is defined.

Returns:

  • (Fixnum)

    Line number.



14
15
16
# File 'lib/gurke/step.rb', line 14

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.



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

def raw
  @raw
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#doc_stringObject



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

def doc_string
  raw.doc_string.value if raw.doc_string
end

#keywordObject



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

def keyword
  raw.keyword
end

#nameObject Also known as: to_s



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

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.



42
43
44
45
46
47
48
49
50
# File 'lib/gurke/step.rb', line 42

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

  result = runner.hook(:step, world) do
    run_step runner, reporter, scenario, world
  end

  reporter.invoke :after_step, result, scenario
end