mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-25 05:45:15 +00:00
12332 - Fix rubocop Rails/I18nLocaleAssignment errors
- use I18n.with_locale method rather than direct locale assignment
This commit is contained in:
@@ -60,14 +60,12 @@ describe Spree::Variant do
|
||||
|
||||
context "price parsing" do
|
||||
before(:each) do
|
||||
I18n.locale = I18n.default_locale
|
||||
I18n.backend.store_translations(:de,
|
||||
{ number: { currency: { format: { delimiter: '.',
|
||||
separator: ',' } } } })
|
||||
end
|
||||
|
||||
after do
|
||||
I18n.locale = I18n.default_locale
|
||||
default_locale = I18n.default_locale
|
||||
I18n.with_locale(default_locale) do
|
||||
I18n.backend.store_translations(:de,
|
||||
{ number: { currency: { format: { delimiter: '.',
|
||||
separator: ',' } } } })
|
||||
end
|
||||
end
|
||||
|
||||
context "price=" do
|
||||
@@ -80,17 +78,19 @@ describe Spree::Variant do
|
||||
|
||||
context "with decimal comma" do
|
||||
it "captures the proper amount for a formatted price" do
|
||||
I18n.locale = :es
|
||||
variant.price = '1.599,99'
|
||||
expect(variant.price).to eq 1599.99
|
||||
I18n.with_locale(:es) do
|
||||
variant.price = '1.599,99'
|
||||
expect(variant.price).to eq 1599.99
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with a numeric price" do
|
||||
it "uses the price as is" do
|
||||
I18n.locale = :es
|
||||
variant.price = 1599.99
|
||||
expect(variant.price).to eq 1599.99
|
||||
I18n.with_locale(:es) do
|
||||
variant.price = 1599.99
|
||||
expect(variant.price).to eq 1599.99
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user