module RSpec::Core::Let::ClassMethods
def let(name, &block)
end
thing.should be_something
# second invocation, returns the memoized value
thing.do_something
# first invocation, executes block, memoizes and returns result
it "does something" do
let(:thing) { Thing.new }
describe Thing do
== Examples
after the first call.
Generates a method whose return value is memoized
def let(name, &block) define_method(name) do __memoized[name] ||= instance_eval(&block) end end