From 9a7d77001c9ca0dd5be6f7ea6daa126a8d6425b9 Mon Sep 17 00:00:00 2001 From: Filippo Liverani Date: Fri, 15 May 2020 17:29:37 +0200 Subject: [PATCH] Fill address names combined when needed In solidusio/solidus#3524 we introduced a new preference that allows to use the combined version of firstname/lastname. This commit updates checkout feature specs to reflect this preference. Once the split version will be deprecated and removed, we can probably also revert this commit and use the combined version only. --- spec/features/checkout_spec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/features/checkout_spec.rb b/spec/features/checkout_spec.rb index 323ea83..0357030 100644 --- a/spec/features/checkout_spec.rb +++ b/spec/features/checkout_spec.rb @@ -403,8 +403,13 @@ def add_to_cart(item_name) def fill_in_address(address) fieldname = 'order_bill_address_attributes' - fill_in "#{fieldname}_firstname", with: address.first_name - fill_in "#{fieldname}_lastname", with: address.last_name + if Spree::Config.has_preference?(:use_combined_first_and_last_name_in_address) && + Spree::Config.use_combined_first_and_last_name_in_address + fill_in "#{fieldname}_name", with: address.name + else + fill_in "#{fieldname}_firstname", with: address.first_name + fill_in "#{fieldname}_lastname", with: address.last_name + end fill_in "#{fieldname}_address1", with: address.address1 fill_in "#{fieldname}_city", with: address.city