2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/spree/testing_support/order_walkthrough.rb', line 2
def self.up_to(state)
unless Spree::PaymentMethod.exists?
FactoryGirl.create(:check_payment_method)
end
zone = FactoryGirl.create(:zone)
country = FactoryGirl.create(:country)
zone.members << Spree::ZoneMember.create(:zoneable => country)
country.states << FactoryGirl.create(:state, :country => country)
unless Spree::ShippingMethod.exists?
FactoryGirl.create(:shipping_method).tap do |sm|
sm.calculator.preferred_amount = 10
sm.calculator.preferred_currency = Spree::Config[:currency]
sm.calculator.save
end
end
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
|