mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Reset I18n.locale to not affect other specs
Otherwise spec/models/enterprise_spec.rb fails if run after this.
This commit is contained in:
@@ -3,6 +3,16 @@ require 'spec_helper'
|
||||
describe I18nHelper do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
# In the real world, the helper is called in every request and sets
|
||||
# I18n.locale to the chosen locale or the default. For testing purposes we
|
||||
# have to restore I18n.locale for unit tests that don't call the helper, but
|
||||
# rely on translated strings.
|
||||
around do |example|
|
||||
locale = I18n.locale
|
||||
example.run
|
||||
I18n.locale = locale
|
||||
end
|
||||
|
||||
context "as guest" do
|
||||
before do
|
||||
allow(helper).to receive(:spree_current_user) { nil }
|
||||
|
||||
Reference in New Issue
Block a user