mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-22 05:18:51 +00:00
Create a "None" calculator for shipping and payment methods
Only for payment and shipping methods
This commit is contained in:
@@ -251,6 +251,14 @@ describe '
|
||||
let!(:payment_method) { create(:payment_method, calculator: calculator) }
|
||||
before { login_as_admin_and_visit spree.edit_admin_payment_method_path payment_method }
|
||||
|
||||
it "handle the 'None' calculator" do
|
||||
select2_select "None", from: 'calc_type'
|
||||
click_button 'Update'
|
||||
expect(page).to have_content("Payment Method has been successfully updated!")
|
||||
expect(payment_method.reload.calculator_type).to eq "Calculator::None"
|
||||
expect(page).to have_select "calc_type", selected: "None"
|
||||
end
|
||||
|
||||
context "using Flat Percent calculator" do
|
||||
before { select2_select "Flat Percent", from: 'calc_type' }
|
||||
|
||||
|
||||
@@ -83,6 +83,15 @@ describe 'shipping methods' do
|
||||
|
||||
expect(@shipping_method.reload.calculator_type).to eq("Calculator::PerItem")
|
||||
end
|
||||
|
||||
it "handle when updating calculator type to 'None'" do
|
||||
visit spree.edit_admin_shipping_method_path(@shipping_method)
|
||||
|
||||
select2_select 'None', from: 'calc_type'
|
||||
click_button 'Update'
|
||||
|
||||
expect(@shipping_method.reload.calculator_type).to eq "Calculator::None"
|
||||
end
|
||||
end
|
||||
|
||||
context "as an enterprise user", js: true do
|
||||
|
||||
Reference in New Issue
Block a user