mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
update preference name in factor and specs
This commit is contained in:
@@ -40,11 +40,11 @@ describe Spree::Admin::ShippingMethodsController, type: :controller do
|
||||
|
||||
it "updates preferred_unit of a Weight calculator" do
|
||||
shipping_method.calculator = create(:weight_calculator, calculable: shipping_method)
|
||||
params[:shipping_method][:calculator_attributes][:preferred_unit] = "kg"
|
||||
params[:shipping_method][:calculator_attributes][:preferred_unit_from_list] = "kg"
|
||||
|
||||
spree_post :update, params
|
||||
|
||||
expect(shipping_method.reload.calculator.preferred_unit).to eq "kg"
|
||||
expect(shipping_method.reload.calculator.preferred_unit_from_list).to eq "kg"
|
||||
end
|
||||
|
||||
it "updates preferred_flat_percent of a FlatPercentPerItem calculator" do
|
||||
|
||||
@@ -15,11 +15,11 @@ FactoryBot.define do
|
||||
factory :weight_calculator, class: Calculator::Weight do
|
||||
after(:build) { |c|
|
||||
c.set_preference(:per_unit, 0.5)
|
||||
c.set_preference(:unit, "kg")
|
||||
c.set_preference(:unit_from_list, "kg")
|
||||
}
|
||||
after(:create) { |c|
|
||||
after(:create) { |c|
|
||||
c.set_preference(:per_unit, 0.5)
|
||||
c.set_preference(:unit, "kg")
|
||||
c.set_preference(:unit_from_list, "kg")
|
||||
c.save!
|
||||
}
|
||||
end
|
||||
|
||||
@@ -118,7 +118,7 @@ feature "full-page cart", js: true do
|
||||
describe "admin weight calculated fees" do
|
||||
context "order with 2 line items" do
|
||||
let(:admin_fee) {
|
||||
create(:enterprise_fee, calculator: Calculator::Weight.new(preferred_per_unit: 1, preferred_unit: "kg"),
|
||||
create(:enterprise_fee, calculator: Calculator::Weight.new(preferred_per_unit: 1, preferred_unit_from_list: "kg"),
|
||||
enterprise: order_cycle.coordinator, fee_type: 'admin')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user