active_cart 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.16
1
+ 0.0.17
@@ -74,7 +74,7 @@ module ActiveCart
74
74
  cart_item.quantity += quantity
75
75
  cart_item.save!
76
76
  else
77
- cart_item = self.send(:cart_items).create!(self.aac_config[:cart_items].to_s.classify.constantize.new_from_item(item, options).attributes.merge(:quantity => quantity, :original_id => item.id, :original_type => item.class.to_s))
77
+ cart_item = self.send(:cart_items).create!(self.aac_config[:cart_items].to_s.classify.constantize.new_from_item(item, { :quantity => quantity }.merge(options)).attributes.merge(:quantity => quantity, :original_id => item.id, :original_type => item.class.to_s))
78
78
  end
79
79
  self.reload
80
80
  end
@@ -8,7 +8,7 @@ module ActiveCart
8
8
  # @cart.check_payment! # transistions from checkout to verifying_payment
9
9
  # @cart.payment_successful! # transitions from verifying_payment to completed
10
10
  # @cart.payment_failed! # transitions from verifying_payment to failed
11
- # @cart.continue_shopping # transitions from checkout or verifying_payment to shopping
11
+ # @cart.continue_shopping # transitions from checkout, verifying_payment or failed to shopping
12
12
  #
13
13
  # It will fire before_ and after callbacks with the same name as the transitions
14
14
  #
@@ -370,6 +370,18 @@ class ActsAsCartTest < ActiveSupport::TestCase
370
370
  @cart.add_to_cart(item, 1, { :options => 'value' })
371
371
  end
372
372
 
373
+ should 'add the quantity to the options hash' do
374
+ item = Item.make
375
+ CartItem.expects(:new_from_item).with(item, { :quantity => 2 }).returns(CartItem.make)
376
+ @cart.add_to_cart(item, 2)
377
+ end
378
+
379
+ should 'allow the quantity to be overriden in the options hash' do
380
+ item = Item.make
381
+ CartItem.expects(:new_from_item).with(item, { :quantity => 4 }).returns(CartItem.make)
382
+ @cart.add_to_cart(item, 2, { :quantity => 4 })
383
+ end
384
+
373
385
  should 'pass options from remove_from_cart to find_cart_item' do
374
386
  item = Item.make
375
387
  @cart.add_to_cart(item, 1)
@@ -383,7 +395,6 @@ class ActsAsCartTest < ActiveSupport::TestCase
383
395
  @cart.expects(:find_cart_item).with(item, { :options => 'value' }).times(2)
384
396
  @cart.update_cart(item, 3, { :options => 'value' })
385
397
  end
386
-
387
398
  end
388
399
 
389
400
  context 'add to cart' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_cart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myles Eftos
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-25 00:00:00 +08:00
12
+ date: 2010-07-11 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency