Module: Turnip::DSL

Defined in:
lib/turnip/dsl.rb

Instance Method Summary collapse

Instance Method Details

#placeholder(*name, &block) ⇒ Object


3
4
5
6
7
# File 'lib/turnip/dsl.rb', line 3

def placeholder(*name, &block)
  name.each do |n|
    Turnip::Placeholder.add(n, &block)
  end
end

#step(description, &block) ⇒ Object


9
10
11
# File 'lib/turnip/dsl.rb', line 9

def step(description, &block)
  Turnip::Steps.step(description, &block)
end

#steps_for(tag, &block) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/turnip/dsl.rb', line 13

def steps_for(tag, &block)
  if tag.to_s == "global"
    warn "[Turnip] using steps_for(:global) is deprecated, add steps to Turnip::Steps instead"
    Turnip::Steps.module_eval(&block)
  else
    Module.new do
      singleton_class.send(:define_method, :tag) { tag }
      module_eval(&block)
      ::RSpec.configure { |c| c.include self, tag => true }
    end
  end
end