Adds minus sign as validation criteria

Removes pending from passing examples
This commit is contained in:
filipefurtad0
2023-05-14 22:51:28 +01:00
parent 596b318778
commit e7ab839fb3
2 changed files with 4 additions and 10 deletions

View File

@@ -45,7 +45,7 @@ module Spree
def self.valid_localizable_number?(number)
return true unless number.is_a?(String) || number.respond_to?(:to_d)
# Invalid if only two digits between dividers, or if any non-number characters
return false if number.to_s =~ /[.,]\d{2}[.,]/ || number.to_s =~ /[^0-9,.]+/
return false if number.to_s =~ /[.,]\d{2}[.,]/ || number.to_s =~ /[^0-9,.-]+/
true
end

View File

@@ -63,23 +63,17 @@ describe '
context "included tax" do
context "adding negative, taxed adjustments to an order" do
it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", "$0.33", "$-1.67" do
before { pending("#10837") }
end
it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", "$0.33", "$-1.67"
end
context "adding positive, taxed adjustments to an order" do
it_behaves_like "when the enable_localized_number preference", "Late fee", "100", "TVA 20%", "$-16.67", "$83.33" do
before { pending("#10837") }
end
it_behaves_like "when the enable_localized_number preference", "Late fee", "100", "TVA 20%", "$-16.67", "$83.33"
end
end
context "added tax" do
context "adding negative, taxed adjustments to an order" do
it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", "$10.00", "$8.00" do
before { pending("#10837") }
end
it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", "$10.00", "$8.00"
end
context "adding positive, taxed adjustments to an order" do