Skip to content

Instantly share code, notes, and snippets.

@dsbw
Created September 18, 2013 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsbw/6616630 to your computer and use it in GitHub Desktop.
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