Module: Lime::Featurette

Defined in:
lib/lime/featurette.rb

Overview

Convenience method for creating a feature mixin.

Examples:


module MyStepDefinitions
  include Lime::Featurette

  Given "customer's name is '(((\s+)))'" do |name|
    @name = name
  end
end

Feature do
  include MyStepDefinitions
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.append_features(base) ⇒ Object



21
22
23
24
25
26
# File 'lib/lime/featurette.rb', line 21

def self.append_features(base)
  base.extend(self)
  base.module_eval %{
    @_advice = Hash.new{ |h,k| h[k] = {} }
  }
end

Instance Method Details

#[](key) ⇒ Object

Access to advice.



62
63
64
# File 'lib/lime/featurette.rb', line 62

def [](key)
  @_advice[key]
end

#Given(description, &procedure) ⇒ Object Also known as: given

Given …

Parameters:

  • description (String)

    A brief description of the given criteria.



33
34
35
# File 'lib/lime/featurette.rb', line 33

def Given(description, &procedure)
  @_advice[:given][description] = procedure
end

#Then(description, &procedure) ⇒ Object Also known as: hence

Then …

Parameters:

  • description (String)

    A brief description of the then criteria.



55
56
57
# File 'lib/lime/featurette.rb', line 55

def Then(description, &procedure)
  @_advice[:then][description] = procedure
end

#When(description, &procedure) ⇒ Object Also known as: wence

When …

Parameters:

  • description (String)

    A brief description of the when criteria.



44
45
46
# File 'lib/lime/featurette.rb', line 44

def When(description, &procedure)
  @_advice[:when][description] = procedure
end