Skip to content

Instantly share code, notes, and snippets.

@dsbw
Created September 18, 2013 22:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dsbw/6616630 to your computer and use it in GitHub Desktop.
describe "let" do
let(:count) { @x = 0 }
let(:count_plus_1) { @x += 1}
it "memoizes the value" do
count.should == 0
count_plus_1.should == 1
end
it "is not cached across examples" do
count_plus_1.should == 2 #undefined method + for nil NIlClass
count.should == 2
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment