Created
September 9, 2011 20:38
-
-
Save austinthecoder/1207270 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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