class RSpec::Steps::Describer

Attributes

group_args[R]
hooks[R]
let_list[R]
metadata[R]
modules[R]
step_list[R]

Public Class Methods

new(args, metadata, &block) click to toggle source
# File lib/rspec-steps/describer.rb, line 10
def initialize(args, metadata, &block)
  @group_args = args
  @metadata = {}
  if @group_args.last.is_a? Hash
    @metadata = @group_args.pop
  end
  @metadata = metadata.merge(@metadata)
  @step_list = StepList.new
  @hooks = []
  @let_list = []
  @modules = []
  instance_eval(&block)
end

Public Instance Methods

after(kind = :all, &callback) click to toggle source
# File lib/rspec-steps/describer.rb, line 81
def after(kind = :all, &callback)
  @hooks << Hook.new(:after, kind, callback)
end
around(kind = :all, &callback) click to toggle source
# File lib/rspec-steps/describer.rb, line 85
def around(kind = :all, &callback)
  @hooks << Hook.new(:around, kind, callback)
end
before(kind = :all, &callback) click to toggle source
# File lib/rspec-steps/describer.rb, line 77
def before(kind = :all, &callback)
  @hooks << Hook.new(:before, kind, callback)
end
extend(mod) click to toggle source
# File lib/rspec-steps/describer.rb, line 53
def extend(mod)
  @modules << ModuleExtension.new(mod)
end
include(mod) click to toggle source
# File lib/rspec-steps/describer.rb, line 49
def include(mod)
  @modules << ModuleInclusion.new(mod)
end
it(*args, &action)
Alias for: step
let(name, &block) click to toggle source
# File lib/rspec-steps/describer.rb, line 65
def let(name, &block)
  @let_list << Let.new(name, block)
end
let!(name, &block) click to toggle source
# File lib/rspec-steps/describer.rb, line 69
def let!(name, &block)
  @let_list << LetBang.new(name, block)
end
next(*args, &action)
Alias for: step
perform_steps(name) click to toggle source
# File lib/rspec-steps/describer.rb, line 57
def perform_steps(name)
  describer = SharedSteps.fetch(name)
  @modules += describer.modules
  @let_list += describer.let_list
  @hooks += describer.hooks
  @step_list += describer.step_list
end
shared_steps(*args, &block) click to toggle source
# File lib/rspec-steps/describer.rb, line 42
def shared_steps(*args, &block)
  name = args.first
  raise "shared step lists need a String for a name" unless name.is_a? String
  raise "there is already a step list named #{name}" if SharedSteps.has_key?(name)
  SharedSteps[name] = Describer.new(args, {:caller => caller}, &block)
end
skip(*args) click to toggle source
# File lib/rspec-steps/describer.rb, line 73
def skip(*args)
  #noop
end
step(*args, &action) click to toggle source
# File lib/rspec-steps/describer.rb, line 25
def step(*args, &action)
  metadata = {}
  if args.last.is_a? Hash
    metadata = args.pop
  end

  metadata = {
    :caller => caller
  }.merge(metadata)

  @step_list << Step.new(metadata, args, action)
end
Also aliased as: when, then, next, it
then(*args, &action)
Alias for: step
when(*args, &action)
Alias for: step