Create a "None" calculator for shipping and payment methods

Only for payment and shipping methods
This commit is contained in:
Jean-Baptiste Bellet
2022-12-26 15:47:43 +01:00
parent c96bba8094
commit a793fc9f99
4 changed files with 34 additions and 2 deletions

View File

@@ -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' }

View File

@@ -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