diff --git a/app/serializers/api/admin/exchange_serializer.rb b/app/serializers/api/admin/exchange_serializer.rb index 64c2c08cd4..cb49d94fc8 100644 --- a/app/serializers/api/admin/exchange_serializer.rb +++ b/app/serializers/api/admin/exchange_serializer.rb @@ -1,5 +1,5 @@ class Api::Admin::ExchangeSerializer < ActiveModel::Serializer - attributes :id, :sender_id, :receiver_id, :incoming, :variants, :pickup_time, :pickup_instructions + attributes :id, :sender_id, :receiver_id, :incoming, :variants, :receival_instructions, :pickup_time, :pickup_instructions has_many :enterprise_fees, serializer: Api::Admin::BasicEnterpriseFeeSerializer diff --git a/spec/features/admin/order_cycles_spec.rb b/spec/features/admin/order_cycles_spec.rb index 2aba4f1a71..aafaa5ee77 100644 --- a/spec/features/admin/order_cycles_spec.rb +++ b/spec/features/admin/order_cycles_spec.rb @@ -102,6 +102,7 @@ feature %q{ # And I add a supplier and some products select 'My supplier', from: 'new_supplier_id' click_button 'Add supplier' + fill_in 'order_cycle_incoming_exchange_0_receival_instructions', with: 'receival instructions' page.find('table.exchanges tr.supplier td.products input').click check "order_cycle_incoming_exchange_0_variants_#{v1.id}" check "order_cycle_incoming_exchange_0_variants_#{v2.id}" @@ -157,8 +158,11 @@ feature %q{ oc.exchanges.first.variants.count.should == 2 oc.exchanges.last.variants.count.should == 2 - # And my pickup time and instructions should have been saved - exchange = oc.exchanges.where(:sender_id => oc.coordinator_id).first + # And my receival and pickup time and instructions should have been saved + exchange = oc.exchanges.incoming.first + exchange.receival_instructions.should == 'receival instructions' + + exchange = oc.exchanges.outgoing.first exchange.pickup_time.should == 'pickup time' exchange.pickup_instructions.should == 'pickup instructions' end @@ -188,6 +192,9 @@ feature %q{ page.should have_selector 'td.supplier_name', :text => oc.suppliers.first.name page.should have_selector 'td.supplier_name', :text => oc.suppliers.last.name + page.should have_field 'order_cycle_incoming_exchange_0_receival_instructions', with: 'instructions 0' + page.should have_field 'order_cycle_incoming_exchange_1_receival_instructions', with: 'instructions 1' + # And the suppliers should have products page.all('table.exchanges tbody tr.supplier').each do |row| row.find('td.products input').click