Class: OrderWalkthrough
- Inherits:
-
Object
- Object
- OrderWalkthrough
- Defined in:
- lib/spree/testing_support/order_walkthrough.rb
Class Method Summary collapse
Class Method Details
.up_to(state) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/spree/testing_support/order_walkthrough.rb', line 2 def self.up_to(state) # A payment method must exist for an order to proceed through the Address state unless Spree::PaymentMethod.exists? FactoryGirl.create(:payment_method) end # A payment method must exist for an order to proceed through the Address state order = Spree::Order.create!(:email => "[email protected]") add_line_item!(order) order.next! end_state_position = states.index(state.to_sym) states[0..end_state_position].each do |state| send(state, order) end order end |