module Shoulda::Let::ContextSupport

Public Instance Methods

let(name, &block) click to toggle source

setup method used outside of should blocks let(:foo){ “Foo” }

# File lib/shoulda/let/context_support.rb, line 6
def let(name, &block)
  name = name.to_sym
  @let ||= {}
  if block
    @let[name] = block
  else
    @let.fetch(name){ parent.let(name) }
  end
end
let!(name, &block) click to toggle source
# File lib/shoulda/let/context_support.rb, line 16
def let!(name, &block)
  let(name, &block)
  setup { let(name) }
end
let_defined?(name) click to toggle source
# File lib/shoulda/let/context_support.rb, line 21
def let_defined?(name)
  name = name.to_sym
  ( @let and @let.has_key?(name) ) ||
    ( parent.respond_to?(:let_defined?) and parent.let_defined?(name) )
end