~cytrogen/masto-fe

ref: 2e1c6e93adc5b573ccf368375f789f2a316f0541 masto-fe/spec/views/shared/_error_messages.html.haml_spec.rb -rw-r--r-- 866 bytes
2e1c6e93 — Renaud Chaput Bump `mkdirp` major version (#24978) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true

require 'rails_helper'

describe 'shared/_error_messages.html.haml' do
  let(:status) { Status.new }

  before { status.errors.add :base, :invalid }

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

    it 'renders the view with one error' do
      render partial: 'shared/error_messages', locals: { object: status }

      expect(rendered).to match(/is invalid/)
    end
  end

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

    it 'renders the view with one error' do
      render partial: 'shared/error_messages', locals: { object: status }

      expect(rendered).to match(/is invalid/)
    end
  end
end