Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@austinthecoder
Created September 9, 2011 20:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save austinthecoder/1207270 to your computer and use it in GitHub Desktop.
Save austinthecoder/1207270 to your computer and use it in GitHub Desktop.
describe Item do
describe "total" do
before do
@item = Item.new
@item.stub!(:calculate_total => 123)
end
it "returns the calculated total" do
@item.total.should == 123
end
it "subsequent calls don't calculate the total, but still return the original result" do
@item.total
@item.should_not_receive(:calculate_total)
@item.total.should == 123
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment