active_cart 0.0.14 → 0.0.15

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.14
1
+ 0.0.15
@@ -4,7 +4,7 @@ module ActiveCart
4
4
  # The CartStorage object uses a state machine to track the state of the cart. The default states are: shopping, checkout, verifying_payment, completed, failed. It exposed the following transitions:
5
5
  # continue_shopping, checkout, check_payment, payment_successful, payment_failed
6
6
  #
7
- # @cart.checkout! # transitions from shopping or verifying_payment to checkout
7
+ # @cart.checkout! # transitions from shopping, verifying_payment or failed to checkout
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
@@ -28,7 +28,7 @@ module ActiveCart
28
28
  end
29
29
 
30
30
  base.aasm_event :checkout do
31
- transitions :from => [ :shopping, :verifying_payment ], :to => :checkout, :guard => :guard_checkout
31
+ transitions :from => [ :shopping, :verifying_payment, :failed ], :to => :checkout, :guard => :guard_checkout
32
32
  end
33
33
 
34
34
  base.aasm_event :check_payment do
@@ -169,6 +169,19 @@ class CartStorageTest < ActiveSupport::TestCase
169
169
  assert_equal :verifying_payment, @cart_storage_engine.state
170
170
  end
171
171
 
172
+ should 'transition from failed to checkout' do
173
+ @cart_storage_engine.expects(:enter_checkout).twice
174
+ @cart_storage_engine.expects(:exit_failed)
175
+ @cart_storage_engine.expects(:guard_check_payment).returns(true)
176
+
177
+ @cart_storage_engine.checkout!
178
+ @cart_storage_engine.check_payment!
179
+ @cart_storage_engine.payment_failed!
180
+ assert_nothing_raised do
181
+ @cart_storage_engine.checkout!
182
+ end
183
+ assert_equal :checkout, @cart_storage_engine.state
184
+ end
172
185
  end
173
186
  end
174
187
 
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.14
4
+ version: 0.0.15
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-21 00:00:00 +08:00
12
+ date: 2010-05-24 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency