module RSpec::Core::MemoizedHelpers::ClassMethods
def let!(name, &block)
end
end
Thing.count.should eq(1)
thing
it "returns memoized version on first invocation" do
end
Thing.count.should eq(1)
it "is invoked implicitly" do
let!(:thing) { Thing.new }
context "using let!" do
end
end
Thing.count.should eq(1)
thing
it "can be invoked explicitly" do
end
Thing.count.should eq(0)
it "is not invoked implicitly" do
let(:thing) { Thing.new }
context "using let" do
after(:example) { Thing.reset_count }
RSpec.describe Thing do
end
end
self.class.count += 1
def initialize
end
@count = 0
def self.reset_count
end
@count += val
def self.count=(val)
end
@count ||= 0
def self.count
class Thing
@example
memoized reference to that state.
hook. This serves a dual purpose of setting up state and providing a
Just like `let`, except the block is invoked by an implicit `before`
def let!(name, &block) let(name, &block) before { __send__(name) } end