I am new to RSpec and I cannot learn how to test the following:
In my application controller (in a Rails 3 application) I set the locale before the filter, e.g.
def set_locale
I18n.locale = ["en", Setting.locale, get_locale_from_subdomain].compact.last
end
def get_locale_from_subdomain
locale = request.subdomain.split('.').first
return nil unless LOCALES.include? locale
locale
end
So basically, “en.example.com” and “example.com” will have “en” locale, while “fr.example.com” will set the locale to “fr".
How can I check this?
source
share