class Spinach::Config

The config object holds all the runtime configurations needed for spinach to run.

Attributes

audit[W]
config_path[W]
default_reporter[W]
fail_fast[W]
failure_exceptions[W]
features_path[W]
generate[W]
orderer_class[W]
reporter_classes[W]
reporter_options[W]
save_and_open_page_on_failure[W]
seed[W]
step_definitions_path[W]
support_path[W]
tags[W]

Public Instance Methods

[](attribute) click to toggle source

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
[]=(attribute, value) click to toggle source

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() click to toggle source

“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
config_path() click to toggle source

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
fail_fast() click to toggle source

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
failure_exceptions() click to toggle source

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
features_path() click to toggle source

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
generate() click to toggle source
# File lib/spinach/config.rb, line 116
def generate
  @generate || false
end
orderer_class() click to toggle source

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_from_file() click to toggle source

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
reporter_classes() click to toggle source

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
reporter_options() click to toggle source

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
save_and_open_page_on_failure() click to toggle source

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
seed() click to toggle source

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
step_definitions_path() click to toggle source

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
support_path() click to toggle source

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
tags() click to toggle source

Tags to tell Spinach that you only want to run scenarios that have (or don't have) certain tags.

@return [Array]

The tags.
# File lib/spinach/config.rb, line 204
def tags
  @tags ||= []
end