|
|
@ -43,16 +43,14 @@ describe LanguageDetector do
|
|
|
|
|
|
|
|
|
|
|
|
describe 'with an account' do
|
|
|
|
describe 'with an account' do
|
|
|
|
it 'uses the account locale when present' do
|
|
|
|
it 'uses the account locale when present' do
|
|
|
|
user = double(:user, locale: 'fr')
|
|
|
|
account = double(user_locale: 'fr')
|
|
|
|
account = double(:account, user: user)
|
|
|
|
|
|
|
|
result = described_class.new('', account).to_iso_s
|
|
|
|
result = described_class.new('', account).to_iso_s
|
|
|
|
|
|
|
|
|
|
|
|
expect(result).to eq :fr
|
|
|
|
expect(result).to eq :fr
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it 'uses default locale when account is present but has no locale' do
|
|
|
|
it 'uses default locale when account is present but has no locale' do
|
|
|
|
user = double(:user, locale: nil)
|
|
|
|
account = double(user_locale: nil)
|
|
|
|
account = double(:accunt, user: user)
|
|
|
|
|
|
|
|
result = described_class.new('', account).to_iso_s
|
|
|
|
result = described_class.new('', account).to_iso_s
|
|
|
|
|
|
|
|
|
|
|
|
expect(result).to eq :en
|
|
|
|
expect(result).to eq :en
|
|
|
|