Module: Spinach::DSL::ClassMethods

Defined in:
lib/spinach/dsl.rb

Overview

Class methods to extend the host class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#feature_nameObject (readonly)

The feature name.



21
22
23
# File 'lib/spinach/dsl.rb', line 21

def feature_name
  @feature_name
end

Instance Method Details

#feature(name) ⇒ Object

Sets the feature name.

Examples:

class MyFeature < Spinach::FeatureSteps
  feature "Satisfy needs"
end

Parameters:

  • name (String)

    The name.



58
59
60
# File 'lib/spinach/dsl.rb', line 58

def feature(name)
  @feature_name = name
end

#Given(step, &block) ⇒ Object Also known as: When, Then, And, But

Defines an action to perform given a particular step literal.

Examples:

class MyFeature < Spinach::FeatureSteps
  When "I go to the toilet" do
    @sittin_on_the_toilet.must_equal true
  end
end

Parameters:

  • step (String)

    The step name.

  • block (Proc)

    Action to perform in that step.



38
39
40
# File 'lib/spinach/dsl.rb', line 38

def Given(step, &block)
  define_method(Spinach::Support.underscore(step), &block)
end