From 84eb8e964d01f0ca37738b505bee8850107b3f3a Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Thu, 24 Sep 2020 07:03:57 -0700 Subject: [PATCH] add specs for weight calculators using lbs --- spec/models/calculator/weight_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/models/calculator/weight_spec.rb b/spec/models/calculator/weight_spec.rb index 702f93fab6..b39d8b84be 100644 --- a/spec/models/calculator/weight_spec.rb +++ b/spec/models/calculator/weight_spec.rb @@ -62,6 +62,8 @@ describe Calculator::Weight do subject.set_preference(:per_unit, 5) subject.set_preference(:unit_from_list, "kg") expect(subject.compute(object_with_order)).to eq(250) # (10 * 1 + 20 * 2) * 5 + subject.set_preference(:unit_from_list, "lb") + expect(subject.compute(object_with_order)).to eq(551.15) # (10 * 1 + 20 * 2) * 5 * 2.2 end context "when line item final_weight_volume is set" do @@ -214,6 +216,8 @@ describe Calculator::Weight do subject.set_preference(:per_unit, 5) subject.set_preference(:unit_from_list, "kg") expect(subject.calculable.errors.count).to eq(0) + subject.set_preference(:unit_from_list, "lb") + expect(subject.calculable.errors.count).to eq(0) end it "does not allow a preferred_unit of anything but 'kg' or 'lb'" do