Class: Spinach::Runner::FeatureRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/spinach/runner/feature_runner.rb

Overview

A feature runner handles a particular feature run.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feature) ⇒ FeatureRunner

Returns a new instance of FeatureRunner.

Parameters:

  • feature (GherkinRuby::AST::Feature)

    The feature to run.



14
15
16
# File 'lib/spinach/runner/feature_runner.rb', line 14

def initialize(feature)
  @feature = feature
end

Instance Attribute Details

#featureObject (readonly)

Returns the value of attribute feature.



8
9
10
# File 'lib/spinach/runner/feature_runner.rb', line 8

def feature
  @feature
end

Instance Method Details

#feature_nameString

Returns This feature name.

Returns:

  • (String)

    This feature name.



22
23
24
# File 'lib/spinach/runner/feature_runner.rb', line 22

def feature_name
  feature.name
end

#runtrue, false

Runs this feature.

Returns:

  • (true, false)

    Whether the run was successful or not.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/spinach/runner/feature_runner.rb', line 40

def run
  Spinach.hooks.run_before_feature(feature)

  if Spinach.find_step_definitions(feature_name)
    run_scenarios!
  else
    undefined_steps!
  end

  Spinach.hooks.run_after_feature(feature)

  # FIXME The feature & scenario runners should have the same structure.
  #       They should either both return inverted failure or both return
  #       raw success.
  !@failed
end

#scenariosArray<GherkinRuby::AST::Scenario>

Returns The parsed scenarios for this runner’s feature.

Returns:

  • (Array<GherkinRuby::AST::Scenario>)

    The parsed scenarios for this runner’s feature.



30
31
32
# File 'lib/spinach/runner/feature_runner.rb', line 30

def scenarios
  feature.scenarios
end