mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Fix FrozenString error
An error was apparent in specs when trying to assign a string as the price. It's not a problem when submitting the form in the browser, I don't know why. But in any case, it shouldn't be trying to modify a variable passed as a parameter.
This commit is contained in:
@@ -44,7 +44,7 @@ module Spree
|
||||
:'number.currency.format.delimiter'])
|
||||
non_price_characters = /[^0-9\-#{separator}]/
|
||||
# Strip everything else first
|
||||
price.gsub!(non_price_characters, '')
|
||||
price = price.gsub(non_price_characters, '')
|
||||
# Then replace the locale-specific decimal separator with the standard separator if necessary
|
||||
price.gsub!(separator, '.') unless separator == '.'
|
||||
|
||||
|
||||
@@ -25,5 +25,14 @@ module Spree
|
||||
expect(expensive_variant.persisted?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context "with string" do
|
||||
it "parses the price" do
|
||||
variant.price = " 10.25 eur"
|
||||
variant.save
|
||||
|
||||
expect(variant.reload.price).to eq 10.25
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user