summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2013-04-29 17:05:50 -0600
committermo khan <mo@mokhan.ca>2013-04-29 17:05:50 -0600
commit6de610122a4fe6f15d4b34fb15b47d3a2069ce88 (patch)
tree43b6ecfadfc94b03abebf8575a73ce73bdd2fa92 /spec
parent1d23b7699061e92364c55184eb078addb5fc06e7 (diff)
start to calculate price of items in cart with a single item in the cart'
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/cart_spec.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/unit/cart_spec.rb b/spec/unit/cart_spec.rb
index c31f6d1..eb77a36 100644
--- a/spec/unit/cart_spec.rb
+++ b/spec/unit/cart_spec.rb
@@ -7,6 +7,12 @@ describe Cart do
let(:phone) { fake }
let(:laptop) { fake }
+ before :each do
+ crayons.stub(:price).and_return(Money.new(1.99))
+ phone.stub(:price).and_return(Money.new(199.99))
+ laptop.stub(:price).and_return(Money.new(1999.99))
+ end
+
context "when there are no items in the cart" do
it "should indicate that no items are included" do
sut.includes?(crayons).should be_false
@@ -16,8 +22,8 @@ describe Cart do
sut.total_items.should == 0
end
- it "should calculate a total cost of $0.00" do
- sut.total_cost.should == Money.new(0.00)
+ it "should calculate a total price of $0.00" do
+ sut.total_price.should == Money.new(0.00)
end
end
@@ -31,6 +37,10 @@ describe Cart do
it "should indicate the total number of unique items in the cart" do
sut.total_items.should == 1
end
+
+ it "should calculate a total price of $0.00" do
+ sut.total_price.should == crayons.price
+ end
end
context "when there are multiples of a single product" do