1
0

i18n_spec.rb 898 B

1234567891011121314151617181920212223242526272829303132333435
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'I18n' do
  4. describe 'Pluralizing locale translations' do
  5. subject { I18n.t('generic.validation_errors', count: 1) }
  6. context 'with the `en` locale which has `one` and `other` plural values' do
  7. around do |example|
  8. I18n.with_locale(:en) do
  9. example.run
  10. end
  11. end
  12. it 'translates to `en` correctly and without error' do
  13. expect { subject }.to_not raise_error
  14. expect(subject).to match(/the error below/)
  15. end
  16. end
  17. context 'with the `my` locale which has only `other` plural value' do
  18. around do |example|
  19. I18n.with_locale(:my) do
  20. example.run
  21. end
  22. end
  23. it 'translates to `my` correctly and without error' do
  24. expect { subject }.to_not raise_error
  25. expect(subject).to match(/1/)
  26. end
  27. end
  28. end
  29. end