mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-07 07:36:58 +00:00
Select by default single Hub/Shop option on creation of payment/shipping method
- added a helper - added mode(new/edit) in payment/shipping views - updated checkbox creation - added tests
This commit is contained in:
@@ -67,6 +67,21 @@ feature '
|
||||
expect(page).to have_selector "#stripe-account-status .charges_enabled", text: "Charges Enabled: Yes"
|
||||
end
|
||||
end
|
||||
|
||||
scenario "checking a single distributor is checked by default" do
|
||||
2.times.each { Enterprise.last.destroy }
|
||||
quick_login_as_admin
|
||||
visit spree.new_admin_payment_method_path
|
||||
expect(page).to have_field "payment_method_distributor_ids_#{@distributors[0].id}", checked: true
|
||||
end
|
||||
|
||||
scenario "checking more than a distributor displays no default choice" do
|
||||
quick_login_as_admin
|
||||
visit spree.new_admin_payment_method_path
|
||||
expect(page).to have_field "payment_method_distributor_ids_#{@distributors[0].id}", checked: false
|
||||
expect(page).to have_field "payment_method_distributor_ids_#{@distributors[1].id}", checked: false
|
||||
expect(page).to have_field "payment_method_distributor_ids_#{@distributors[2].id}", checked: false
|
||||
end
|
||||
end
|
||||
|
||||
scenario "updating a payment method", js: true do
|
||||
|
||||
@@ -65,6 +65,20 @@ feature 'shipping methods' do
|
||||
expect(page).to have_content "That shipping method cannot be deleted as it is referenced by an order: #{o.number}."
|
||||
expect(Spree::ShippingMethod.find(@sm.id)).not_to be_nil
|
||||
end
|
||||
|
||||
scenario "checking a single distributor is checked by default" do
|
||||
d1 = Enterprise.first
|
||||
visit spree.new_admin_shipping_method_path
|
||||
expect(page).to have_field "shipping_method_distributor_ids_#{d1.id}", checked: true
|
||||
end
|
||||
|
||||
scenario "checking more than a distributor displays no default choice" do
|
||||
d1 = create(:distributor_enterprise, name: 'Aeronautical Adventures')
|
||||
d2 = create(:distributor_enterprise, name: 'Nautical Travels')
|
||||
visit spree.new_admin_shipping_method_path
|
||||
expect(page).to have_field "shipping_method_distributor_ids_#{d1.id}", checked: false
|
||||
expect(page).to have_field "shipping_method_distributor_ids_#{d2.id}", checked: false
|
||||
end
|
||||
end
|
||||
|
||||
context "as an enterprise user", js: true do
|
||||
|
||||
Reference in New Issue
Block a user