active_cart 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.13
1
+ 0.0.14
@@ -126,7 +126,7 @@ module ActiveCart
126
126
  # @cart.sub_total # => 100.00
127
127
  #
128
128
  def sub_total
129
- inject(0) { |t, item| t + (item.quantity * item.price) }
129
+ inject(0) { |t, item| t + (item.quantity * item.price.to_f) }
130
130
  end
131
131
 
132
132
  # Returns the number of items in the cart. It takes into account the individual quantities of each item, eg if there are 3 items in the cart, each with a quantity of 2, this will return 6
@@ -182,6 +182,13 @@ class CartStorageTest < ActiveSupport::TestCase
182
182
  @item_3.price = 9
183
183
  end
184
184
 
185
+ should 'cast the price to a float' do
186
+ price = mock()
187
+ @item_1.stubs(:price).returns(price)
188
+ @cart.add_to_cart(@item_1)
189
+ @item_1.price.expects(:to_f).returns(10).once
190
+ assert_equal 10, @cart.sub_total
191
+ end
185
192
 
186
193
  should 'return the price of a single item in the cart' do
187
194
  @cart.add_to_cart(@item_1)
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.13
4
+ version: 0.0.14
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-19 00:00:00 +08:00
12
+ date: 2010-05-21 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency