svenfuchs/globalize3 — Issue #114: Resetting locale during testing
Author: charlesdeb
Created: 2012-03-06 20:39:27+00:00
State: open

This is probably user error, but I've (and failed) to spot what my error is...

When I am doing rspec tests on my models, debugging code shows that Refinery::I18n.current_locale seems to have been set from some other testing session. I have tried in vain to set it to the locale I want for my current tests using:

Refinery::I18n.current_locale = :en
or
I18n.current_locale = :en

and even

Globalize.with_locale(:en) do
....
end

all to no avail - which work fine in the console.

My records (in various different tests and models) are getting saved with a non-english locale. I am guessing that I could stop this is by doing a visit "/en/some_page" - which I don't want to do from my model tests since it slows them down - and I can't get "visit" to work in a model test (it's only supposed to be used for integration adn functional tests I think?)