Sha256: c7eca6f915f8e13411b0ab2de15b7033cab6381157e040b0ead83eb7cbf177be
Contents?: true
Size: 692 Bytes
Versions: 10
Compression:
Stored size: 692 Bytes
Contents
require 'spec_helper' describe "#let" do let(:counter) do Class.new do def initialize @count = 0 end def count @count += 1 end end.new end it "generates an instance method" do counter.count.should == 1 end it "caches the value" do counter.count.should == 1 counter.count.should == 2 end end describe "#let!" do let!(:creator) do class Creator @count = 0 def self.count @count += 1 end end end it "evaluates the value non-lazily" do lambda { Creator.count }.should_not raise_error end it "does not interfere between tests" do Creator.count.should == 1 end end
Version data entries
10 entries across 10 versions & 1 rubygems