diff options
| author | mo khan <mo@mokhan.ca> | 2013-04-29 16:20:35 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-04-29 16:20:35 -0600 |
| commit | b74e8632e8defe3015332bff064285bf3e0b970f (patch) | |
| tree | 09cc19fc54dea8a221d3735f4597a7b6302dbe5b | |
| parent | 9587dd0f2ae8629aa127766523ea58b1586d9233 (diff) | |
move customer to separate file
| -rw-r--r-- | lib/customer.rb | 9 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 2 | ||||
| -rw-r--r-- | spec/unit/customer_spec.rb | 10 |
3 files changed, 11 insertions, 10 deletions
diff --git a/lib/customer.rb b/lib/customer.rb new file mode 100644 index 0000000..68a6476 --- /dev/null +++ b/lib/customer.rb @@ -0,0 +1,9 @@ +class Customer + def initialize(cart) + @cart = cart + end + + def add_to_cart(product) + @cart.add(product) + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3112ee0..fe6867d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,4 @@ require 'rspec' require 'rspec-fakes' + +require_relative '../lib/customer.rb' diff --git a/spec/unit/customer_spec.rb b/spec/unit/customer_spec.rb index 03a567e..08f387b 100644 --- a/spec/unit/customer_spec.rb +++ b/spec/unit/customer_spec.rb @@ -1,15 +1,5 @@ require "spec_helper" -class Customer - def initialize(cart) - @cart = cart - end - - def add_to_cart(product) - @cart.add(product) - end -end - describe Customer do let(:cart) { fake } let(:sut) { Customer.new(cart) } |
