Ensure customer selection dropdown is visible when adding customer details

For some reason the order is in address state here instead of cart state when adding customer details. There's a conditional in the view which loads the customer selection dropdown that was not being triggered, so a customer could not be selected (and their existing address was not being filled out in the form).

Fixes:

  1)
    As an administrator
    I want to manage orders
 filling customer details
     Failure/Error: expect(order.ship_address.lastname).to eq @customer.ship_address.lastname

     NoMethodError:
       undefined method `lastname' for nil:NilClass
     # ./spec/features/admin/orders_spec.rb:179:in `block (2 levels) in <top (required)>'
This commit is contained in:
Matt-Yorkley
2020-03-12 10:50:10 +01:00
parent 4ea891ee2f
commit 80e5608436
2 changed files with 4 additions and 1 deletions

View File

@@ -9,7 +9,7 @@
- content_for :page_actions do
%li= button_link_to Spree.t(:back_to_orders_list), admin_orders_path, :icon => 'icon-arrow-left'
- if @order.cart?
- if @order.cart? || @order.address?
#select-customer{"data-hook" => ""}
%fieldset.no-border-bottom
%legend{:align => "center"}= Spree.t(:customer_search)

View File

@@ -169,6 +169,9 @@ feature '
expect(page).to have_selector 'h1.page-title', text: "Customer Details"
# The customer selection partial should be visible
expect(page).to have_selector '#select-customer'
# And I select that customer's email address and save the order
targetted_select2_search @customer.email, from: '#customer_search_override', dropdown_css: '.select2-drop'
click_button 'Update'