Class: Spinach::Runner
- Inherits:
-
Object
- Object
- Spinach::Runner
- Includes:
- Hooks
- Defined in:
- lib/spinach/runner.rb,
lib/spinach/runner/feature.rb,
lib/spinach/runner/scenario.rb
Overview
Runner gets the parsed data from the feature and performs the actual calls to the feature classes.
Defined Under Namespace
Instance Attribute Summary collapse
-
#filenames ⇒ Object
readonly
The feature files to run.
-
#step_definitions_path ⇒ Object
readonly
The default path where the steps are located.
-
#support_path ⇒ Object
readonly
The default path where the support files are located.
Instance Method Summary collapse
-
#initialize(filenames, options = {}) ⇒ Runner
constructor
Initializes the runner with a parsed feature.
-
#require_dependencies ⇒ Object
Loads step definitions and support files.
-
#require_suites ⇒ Object
Requires the test suite support.
-
#run ⇒ true, false
Runs this runner and outputs the results in a colorful manner.
-
#step_definition_files ⇒ Array<String>
Files The step definition files.
-
#support_files ⇒ Array<String>
Files The support files.
Constructor Details
#initialize(filenames, options = {}) ⇒ Runner
Initializes the runner with a parsed feature
36 37 38 39 40 41 42 43 44 |
# File 'lib/spinach/runner.rb', line 36 def initialize(filenames, = {}) @filenames = filenames @step_definitions_path = .delete(:step_definitions_path ) || Spinach.config.step_definitions_path @support_path = .delete(:support_path ) || Spinach.config.support_path end |
Instance Attribute Details
#filenames ⇒ Object (readonly)
The feature files to run
11 12 13 |
# File 'lib/spinach/runner.rb', line 11 def filenames @filenames end |
#step_definitions_path ⇒ Object (readonly)
The default path where the steps are located
14 15 16 |
# File 'lib/spinach/runner.rb', line 14 def step_definitions_path @step_definitions_path end |
#support_path ⇒ Object (readonly)
The default path where the support files are located
17 18 19 |
# File 'lib/spinach/runner.rb', line 17 def support_path @support_path end |
Instance Method Details
#require_dependencies ⇒ Object
Loads step definitions and support files.
82 83 84 85 86 |
# File 'lib/spinach/runner.rb', line 82 def require_dependencies (support_files + step_definition_files).each do |file| require file end end |
#require_suites ⇒ Object
Requires the test suite support
90 91 92 |
# File 'lib/spinach/runner.rb', line 90 def require_suites require_relative 'suites' end |
#run ⇒ true, false
Runs this runner and outputs the results in a colorful manner.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/spinach/runner.rb', line 61 def run require_dependencies require_suites run_hook :before_run successful = true filenames.each do |filename| success = Feature.new(filename).run successful = false unless success end run_hook :after_run, successful successful end |
#step_definition_files ⇒ Array<String>
Returns files The step definition files.
98 99 100 101 102 |
# File 'lib/spinach/runner.rb', line 98 def step_definition_files Dir.glob( File. File.join(step_definitions_path, '**', '*.rb') ) end |
#support_files ⇒ Array<String>
Returns files The support files.
108 109 110 111 112 |
# File 'lib/spinach/runner.rb', line 108 def support_files Dir.glob( File. File.join(support_path, '**', '*.rb') ) end |