mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
When editing an order cycle, distributor collection details are loaded
This commit is contained in:
@@ -10,5 +10,8 @@ r.element :order_cycle, @order_cycle do
|
||||
r.element :receiver_id
|
||||
|
||||
r.element :variants, Hash[ exchange.variants.map { |v| [v.id, true] } ], {}
|
||||
|
||||
r.element :pickup_time
|
||||
r.element :pickup_instructions
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,8 +9,8 @@ FactoryGirl.define do
|
||||
ex2 = create(:exchange, :order_cycle => oc, :receiver => oc.coordinator)
|
||||
|
||||
# Distributors
|
||||
create(:exchange, :order_cycle => oc, :sender => oc.coordinator)
|
||||
create(:exchange, :order_cycle => oc, :sender => oc.coordinator)
|
||||
create(:exchange, :order_cycle => oc, :sender => oc.coordinator, :pickup_time => 'time 0', :pickup_instructions => 'instructions 0')
|
||||
create(:exchange, :order_cycle => oc, :sender => oc.coordinator, :pickup_time => 'time 1', :pickup_instructions => 'instructions 1')
|
||||
|
||||
# Products with images
|
||||
[ex1, ex2].each do |exchange|
|
||||
@@ -29,7 +29,7 @@ FactoryGirl.define do
|
||||
orders_open_at { Time.zone.now - 1.day }
|
||||
orders_close_at { Time.zone.now + 1.week }
|
||||
|
||||
coordinator { Enterprise.first || FactoryGirl.create(:enterprise) }
|
||||
coordinator { Enterprise.is_distributor.first || FactoryGirl.create(:distributor_enterprise) }
|
||||
end
|
||||
|
||||
factory :exchange, :class => Exchange do
|
||||
|
||||
@@ -32,7 +32,7 @@ feature %q{
|
||||
|
||||
scenario "creating an order cycle" do
|
||||
# Given coordinating, supplying and distributing enterprises with some products with variants
|
||||
create(:enterprise, name: 'My coordinator')
|
||||
create(:distributor_enterprise, name: 'My coordinator')
|
||||
supplier = create(:supplier_enterprise, name: 'My supplier')
|
||||
product = create(:product, supplier: supplier)
|
||||
create(:variant, product: product)
|
||||
@@ -128,6 +128,11 @@ feature %q{
|
||||
page.should have_selector 'td.distributor_name', :text => oc.distributors.first.name
|
||||
page.should have_selector 'td.distributor_name', :text => oc.distributors.last.name
|
||||
|
||||
page.find('#order_cycle_outgoing_exchange_0_pickup_time').value.should == 'time 0'
|
||||
page.find('#order_cycle_outgoing_exchange_0_pickup_instructions').value.should == 'instructions 0'
|
||||
page.find('#order_cycle_outgoing_exchange_1_pickup_time').value.should == 'time 1'
|
||||
page.find('#order_cycle_outgoing_exchange_1_pickup_instructions').value.should == 'instructions 1'
|
||||
|
||||
page.all('table.exchanges tbody tr.distributor').each do |row|
|
||||
row.find('td.products input').click
|
||||
|
||||
@@ -144,7 +149,7 @@ feature %q{
|
||||
oc = create(:order_cycle)
|
||||
|
||||
# And a coordinating, supplying and distributing enterprise with some products with variants
|
||||
create(:enterprise, name: 'My coordinator')
|
||||
create(:distributor_enterprise, name: 'My coordinator')
|
||||
supplier = create(:supplier_enterprise, name: 'My supplier')
|
||||
distributor = create(:distributor_enterprise, name: 'My distributor')
|
||||
product = create(:product, supplier: supplier)
|
||||
|
||||
Reference in New Issue
Block a user