Skip to content

Commit

Permalink
Display receival instructions when editing order cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
RohanM committed Jan 29, 2016
1 parent d562f65 commit 533124f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/serializers/api/admin/exchange_serializer.rb
Original file line number Diff line number Diff line change
@@ -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

Expand Down
11 changes: 9 additions & 2 deletions spec/features/admin/order_cycles_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
# 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}"
Expand Down Expand Up @@ -157,8 +158,11 @@
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
Expand Down Expand Up @@ -188,6 +192,9 @@
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
Expand Down

0 comments on commit 533124f

Please sign in to comment.