class Spinach::Config
The config object holds all the runtime configurations needed for spinach to run.
Attributes
Public Instance Methods
Allows you to read the config object using a hash-like syntax.
@param [String] attribute
The attribute to fetch.
@example
Spinach.config[:step_definitions_path] # => 'features/steps'
@api public
# File lib/spinach/config.rb, line 130 def [](attribute) self.send(attribute) end
Allows you to set config properties using a hash-like syntax.
@param [#to_s] attribute
The attribute to set.
@param [Object] value
The value to set the attribute to.
@example
Spinach.config[:step_definitions_path] = 'integration/steps' # => 'integration/steps'
@api public
# File lib/spinach/config.rb, line 147 def []=(attribute, value) self.send("#{attribute}=", value) end
“audit” enables step auditing mode
@return [true/false]
The audit flag.
@api public
# File lib/spinach/config.rb, line 178 def audit @audit || false end
It allows you to set a config file to parse for all the other options to be set
@return [String]
The config file name
# File lib/spinach/config.rb, line 187 def config_path @config_path ||= 'config/spinach.yml' end
The “fail_fast” determines if the suite run should exit when encountering a failure/error
@return [true/false]
The fail_fast flag.
@api public
# File lib/spinach/config.rb, line 168 def fail_fast @fail_fast end
The failure exceptions return an array of exceptions to be captured and considered as failures (as opposite of errors)
@return [Array<Exception>]
@api public
# File lib/spinach/config.rb, line 157 def failure_exceptions @failure_exceptions ||= [] end
The “features path” holds the place where your features will be searched for. Defaults to 'features'
@return [String]
The features path.
@api public
# File lib/spinach/config.rb, line 49 def features_path @features_path || 'features' end
# File lib/spinach/config.rb, line 116 def generate @generate || false end
The “orderer class” holds the orderer class name Defaults to Spinach::Orderers::Default
@return [orderer object]
The orderer that responds to specific messages.
@api public
# File lib/spinach/config.rb, line 78 def orderer_class @orderer_class || "Spinach::Orderers::Default" end
Parse options from the config file
@return [Boolean]
If the config was parsed from the file
# File lib/spinach/config.rb, line 213 def parse_from_file parsed_opts = YAML.load_file(config_path) parsed_opts.delete_if{|k| k.to_s == 'config_path'} parsed_opts.each_pair{|k,v| self[k] = v} true rescue Errno::ENOENT false end
The “reporter classes” holds an array of reporter class name Default to [“Spinach::Reporter::Stdout”]
@return [Array<reporter object>]
The reporters that respond to specific messages.
@api public
# File lib/spinach/config.rb, line 60 def reporter_classes @reporter_classes || ["Spinach::Reporter::Stdout"] end
The “reporter_options” holds the options passed to reporter_classes
@api public
# File lib/spinach/config.rb, line 67 def reporter_options @reporter_options || {} end
When using capybara, it automatically shows the current page when there's a failure
# File lib/spinach/config.rb, line 194 def save_and_open_page_on_failure @save_and_open_page_on_failure ||= false end
A randomization seed. This is what spinach uses for test run randomization, so if you call `Kernel.srand(Spinach.config
.seed)` in your support environment file, not only will the test run order be guaranteed to be stable under a specific seed, all the Ruby-generated random numbers produced during your test run will also be stable under that seed.
@api public
# File lib/spinach/config.rb, line 90 def seed @seed ||= rand(0xFFFF) end
The “step definitions path” holds the place where your feature step classes will be searched for. Defaults to '#{features_path}/steps'
@return [String]
The step definitions path.
@api public
# File lib/spinach/config.rb, line 101 def step_definitions_path @step_definitions_path || "#{self.features_path}/steps" end
The “support path” helds the place where you can put your configuration files. Defaults to '#{features_path}/support'
@return [String]
The support file path.
@api public
# File lib/spinach/config.rb, line 112 def support_path @support_path || "#{self.features_path}/support" end