update preference name in factor and specs

This commit is contained in:
Andy Brett
2020-09-12 12:35:34 -07:00
parent 37cfe65688
commit 246934d8ba
3 changed files with 6 additions and 6 deletions

View File

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

View File

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

View File

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