Skip to content

Commit

Permalink
Replace i18n view spec with helper spec (mastodon#24966)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski authored May 15, 2023
1 parent 2e1c6e9 commit b84bc2d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 37 deletions.
35 changes: 35 additions & 0 deletions spec/locales/i18n_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

require 'rails_helper'

describe 'I18n' do
describe 'Pluralizing locale translations' do
subject { I18n.t('generic.validation_errors', count: 1) }

context 'with the `en` locale which has `one` and `other` plural values' do
around do |example|
I18n.with_locale(:en) do
example.run
end
end

it 'translates to `en` correctly and without error' do
expect { subject }.to_not raise_error
expect(subject).to match(/the error below/)
end
end

context 'with the `my` locale which has only `other` plural value' do
around do |example|
I18n.with_locale(:my) do
example.run
end
end

it 'translates to `my` correctly and without error' do
expect { subject }.to_not raise_error
expect(subject).to match(/1/)
end
end
end
end
37 changes: 0 additions & 37 deletions spec/views/shared/_error_messages.html.haml_spec.rb

This file was deleted.

0 comments on commit b84bc2d

Please sign in to comment.