locale_spec.rb 574 B

1234567891011121314151617181920212223
  1. require 'rails_helper'
  2. RSpec.describe Locale, type: :model do
  3. describe 'Class methods:' do
  4. describe '.default' do
  5. context 'with default locale' do
  6. before { Setting.set('locale_default', 'foo') }
  7. it 'returns the system-wide default locale' do
  8. expect(described_class.default).to eq('foo')
  9. end
  10. end
  11. context 'without default locale' do
  12. before { Setting.set('locale_default', nil) }
  13. it 'returns en-us' do
  14. expect(described_class.default).to eq('en-us')
  15. end
  16. end
  17. end
  18. end
  19. end