Skip to content

Commit

Permalink
Fill address names combined when needed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
filippoliverani committed May 15, 2020
1 parent 4005651 commit 9a7d770
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spec/features/checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a7d770

Please sign in to comment.