Adjust order_cycles/simple_spec.rb to take new Checkout Options step into account

Note, this doesn't test checking/unchecking some distributor shipping methods and not others because that is tested in order_cycles/complex_creating_time_specific_spec.rb.
This commit is contained in:
Cillian O'Ruanaidh
2022-09-21 21:40:02 +01:00
committed by Filipe
parent db92e9d91c
commit 23f6901fb4

View File

@@ -260,6 +260,11 @@ describe '
find(:css, "tags-input .tags input").set "wholesale\n"
end
click_button 'Save and Next'
expect_shipping_methods_to_be_checked_for(distributor_managed)
expect_shipping_methods_to_be_checked_for(distributor_permitted)
click_button 'Save and Back to List'
order_cycle = OrderCycle.find_by(name: 'My order cycle')
expect(page).to have_input "oc#{order_cycle.id}[name]", value: order_cycle.name
@@ -270,6 +275,9 @@ describe '
expect(order_cycle.schedules).to eq([schedule])
exchange = order_cycle.exchanges.outgoing.to_enterprise(distributor_managed).first
expect(exchange.tag_list).to eq(["wholesale"])
expect(order_cycle.distributor_shipping_methods).to match_array(
order_cycle.attachable_distributor_shipping_methods
)
end
context "editing an order cycle" do
@@ -308,6 +316,7 @@ describe '
# And I remove all outgoing exchanges
page.find("tr.distributor-#{distributor_managed.id} a.remove-exchange").click
page.find("tr.distributor-#{distributor_permitted.id} a.remove-exchange").click
click_button 'Save and Next'
click_button 'Save and Back to List'
expect(page).to have_input "oc#{oc.id}[name]", value: oc.name
@@ -706,6 +715,14 @@ describe '
private
def expect_shipping_methods_to_be_checked_for(distributor)
distributor.distributor_shipping_method_ids.each do |distributor_shipping_method_id|
expect(page).to have_checked_field(
"order_cycle_selected_distributor_shipping_method_ids_#{distributor_shipping_method_id}"
)
end
end
def wait_for_edit_form_to_load_order_cycle(order_cycle)
expect(page).to have_field "order_cycle_name", with: order_cycle.name
end