module Spinach

Spinach is a BDD framework leveraging the great GherkinRuby language. This language is the one used defining features in Cucumber, the BDD framework Spinach is inspired upon.

Its main design goals are:

* No magic: All features are implemented using normal Ruby classes.
* Reusability: Steps are methods, so they can be reused using modules, a
  common, normal practice among rubyists.
* Proper encapsulation: No conflicts between steps from different
  scenarios.

Constants

VERSION

Spinach version.

Public Class Methods

config() click to toggle source

Accesses spinach config. Allows you to configure several runtime options, like the step definitions path.

@return [Config]

The config object

@example

Spinach.config[:step_definitions_path]
  # => 'features/steps'
Spinach.config[:step_definitions_path] = 'integration/steps'
  # => 'integration/steps'

@api public

# File lib/spinach/config.rb, line 17
def self.config
  @config ||= Config.new
end
feature_steps() click to toggle source

@return [Array<FeatureSteps>]

All the registered features.

@api public

# File lib/spinach.rb, line 42
def self.feature_steps
  @@feature_steps
end
find_step_definitions(name) click to toggle source

Finds step definitions given a feature name.

@param [String] name

The feature name to get the definitions for.

@return [StepDefinitions]

the {StepDefinitions} class for the given feature name

@api public

# File lib/spinach.rb, line 70
def self.find_step_definitions(name)
  klass = Spinach::Support.camelize(name)
  scoped_klass = Spinach::Support.scoped_camelize(name)
  feature_steps.detect do |feature|
      feature.name == klass ||
      feature.name == scoped_klass ||
      feature.feature_name.to_s == name.to_s
  end
end
hooks() click to toggle source

Returns a new hook object that will receive all the messages from the run and fire up the appropiate callbacks when needed.

# File lib/spinach.rb, line 57
def self.hooks
  @@hooks ||= Hooks.new
end
reset_feature_steps() click to toggle source

Resets Spinach to a pristine state, as if no feature was ever registered. Mostly useful in Spinach's own testing.

@api semipublic

# File lib/spinach.rb, line 50
def self.reset_feature_steps
  @@feature_steps = []
end