module RSpec::Core::MemoizedHelpers::ClassMethods
def subject!(name=nil, &block)
end
end
Thing.count.should eq(1)
subject
it "returns memoized version on first invocation" do
end
Thing.count.should eq(1)
it "is invoked implicitly" do
subject!(:thing) { Thing.new }
context "using subject!" do
end
end
Thing.count.should eq(1)
subject
it "can be invoked explicitly" do
end
Thing.count.should eq(0)
it "is not invoked implicitly" do
subject { Thing.new }
context "using subject" 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
providing a memoized reference to that state.
`before` hook. This serves a dual purpose of setting up state and
Just like `subject`, except the block is invoked by an implicit
def subject!(name=nil, &block) subject(name, &block) before { subject } end