From 241e581779edea4e5ce3b61dd3240ce7d0523997 Mon Sep 17 00:00:00 2001 From: Dan Ingenthron Date: Wed, 9 Oct 2019 00:20:52 -0500 Subject: [PATCH] Add required fields to order cycle spec --- spec/features/admin/order_cycles_spec.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/spec/features/admin/order_cycles_spec.rb b/spec/features/admin/order_cycles_spec.rb index 397ccec9cd..f2dba44c5a 100644 --- a/spec/features/admin/order_cycles_spec.rb +++ b/spec/features/admin/order_cycles_spec.rb @@ -181,11 +181,17 @@ feature ' select2_select 'My coordinator', from: 'coordinator_id' click_button "Continue >" - # And I fill in the basic fields + # I cannot save before filling in the required fields + expect(page).to have_button("Create", disabled: true) + + # After I fill in the basic fields fill_in 'order_cycle_name', with: 'Plums & Avos' fill_in 'order_cycle_orders_open_at', with: order_cycle_opening_time fill_in 'order_cycle_orders_close_at', with: order_cycle_closing_time + # I can save the form + expect(page).to have_button("Create", disabled: false) + # And I add a coordinator fee click_button 'Add coordinator fee' select 'Coord fee', from: 'order_cycle_coordinator_fee_0_id' @@ -998,13 +1004,19 @@ feature ' visit admin_order_cycles_path click_link 'New Order Cycle' - # And I fill in the basic fields + # I cannot save without the required fields + expect(page).to have_button('Create', disabled: true) + + # After I fill in the basic fields fill_in 'order_cycle_name', with: 'Plums & Avos' fill_in 'order_cycle_orders_open_at', with: '2040-10-17 06:00:00' fill_in 'order_cycle_orders_close_at', with: '2040-10-24 17:00:00' fill_in 'order_cycle_outgoing_exchange_0_pickup_time', with: 'pickup time' fill_in 'order_cycle_outgoing_exchange_0_pickup_instructions', with: 'pickup instructions' + # I can save the form + expect(page).to have_button('Create', disabled: false) + # Then my products / variants should already be selected expect(page).to have_checked_field "order_cycle_incoming_exchange_0_variants_#{v1.id}" expect(page).to have_checked_field "order_cycle_incoming_exchange_0_variants_#{v2.id}"