update units list on Spree::Admin::GeneralSettingsHelper#all_units

added a test to make sure that all units on WeightsAndMeasures::UNITS are list on all_units
This commit is contained in:
Mohamed ABDELLANI
2023-10-31 18:57:42 +01:00
parent 642cd85cb9
commit fb24678654
2 changed files with 14 additions and 1 deletions

View File

@@ -4,7 +4,12 @@ module Spree
module Admin
module GeneralSettingsHelper
def all_units
["g", "oz", "lb", "kg", "T", "mL", "L", "kL"]
[
"mg", "g", "kg", "T",
"oz", "lb",
"mL", "cL", "dL", "L", "kL",
"gal"
]
end
end
end

View File

@@ -90,4 +90,12 @@ describe WeightsAndMeasures do
end
end
end
describe "UNITS" do
include Spree::Admin::GeneralSettingsHelper
it "should include all the available untis" do
units = WeightsAndMeasures::UNITS.values.flat_map(&:values).pluck("name").sort.uniq
expect(units).to eq(all_units.sort.uniq)
end
end
end