Commit f0f0a26
Changed files (3)
lib
spec
lib/cart.rb
@@ -0,0 +1,19 @@
+class Cart
+ def initialize(items = [])
+ @items = items
+ end
+
+ def add(product)
+ @items.push(product)
+ end
+
+ def includes?(product)
+ @items.include?(product)
+ end
+
+ def quantity_of(product)
+ @items.find_all do |item|
+ item == product
+ end.count
+ end
+end
spec/unit/cart_spec.rb
@@ -1,25 +1,5 @@
require "spec_helper"
-class Cart
- def initialize(items = [])
- @items = items
- end
-
- def add(product)
- @items.push(product)
- end
-
- def includes?(product)
- @items.include?(product)
- end
-
- def quantity_of(product)
- @items.find_all do |item|
- item == product
- end.count
- end
-end
-
describe Cart do
let(:sut) { Cart.new }
spec/spec_helper.rb
@@ -1,4 +1,5 @@
require 'rspec'
require 'rspec-fakes'
+require_relative '../lib/cart.rb'
require_relative '../lib/customer.rb'