mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
order_with_totals_and_distribut{or,ion}
This commit is contained in:
@@ -140,9 +140,10 @@ FactoryGirl.define do
|
||||
after(:create) { |c| c.set_preference(:per_kg, 0.5); c.save! }
|
||||
end
|
||||
|
||||
factory :order_with_totals_and_distributor, :parent => :order do #possibly called :order_with_line_items in newer Spree
|
||||
# Ensure order has a distributor set
|
||||
factory :order_with_totals_and_distribution, :parent => :order do #possibly called :order_with_line_items in newer Spree
|
||||
distributor { create(:distributor_enterprise) }
|
||||
order_cycle { create(:simple_order_cycle) }
|
||||
|
||||
after(:create) do |order|
|
||||
p = create(:simple_product, :distributors => [order.distributor])
|
||||
FactoryGirl.create(:line_item, :order => order, :product => p)
|
||||
|
||||
@@ -9,7 +9,7 @@ feature %q{
|
||||
|
||||
background do
|
||||
@user = create(:user)
|
||||
@order = create(:order_with_totals_and_distributor, :user => @user, :state => 'complete', :payment_state => 'balance_due')
|
||||
@order = create(:order_with_totals_and_distribution, user: @user, state: 'complete', payment_state: 'balance_due')
|
||||
|
||||
# ensure order has a payment to capture
|
||||
@order.finalize!
|
||||
@@ -44,6 +44,8 @@ feature %q{
|
||||
end
|
||||
|
||||
scenario "can't change distributor or order cycle once order has been finalized" do
|
||||
@order.update_attributes order_cycle_id: nil
|
||||
|
||||
login_to_admin_section
|
||||
visit '/admin/orders'
|
||||
page.find('td.actions a.icon-edit').click
|
||||
@@ -52,7 +54,7 @@ feature %q{
|
||||
page.should have_no_select 'order_order_cycle_id'
|
||||
|
||||
page.should have_selector 'p', text: "Distributor: #{@order.distributor.name}"
|
||||
page.should have_selector 'p', text: 'Order cycle: None'
|
||||
page.should have_selector 'p', text: "Order cycle: None"
|
||||
end
|
||||
|
||||
scenario "capture multiple payments from the orders index page" do
|
||||
|
||||
Reference in New Issue
Block a user