mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Adds minus sign as validation criteria
Removes pending from passing examples
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user