order_with_totals_and_distribut{or,ion}

This commit is contained in:
Rohan Mitchell
2014-07-16 10:33:23 +10:00
parent 42b951c972
commit 6dfd26ac69
2 changed files with 7 additions and 4 deletions

View File

@@ -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)

View File

@@ -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