Sha256: c3329eb09811dd0cb9448b8b4f373c0a94b1a334d45a11b43638e00c5a1d0145

Contents?: true

Size: 745 Bytes

Versions: 6

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

RSpec.describe PluralForms do
  it "returns plural forms" do
    expect(described_class.all).to include(
      { cy: %i[few many one other two zero], en: %i[one other] }
    )
  end

  context "when there are missing plural forms" do
    around do |example|
      load_path = I18n.load_path
      # strips I18n of all pluralization files (rules)
      I18n.load_path = I18n.load_path.flatten.reject { |path| path =~ /plural/ }

      example.run

      I18n.load_path = load_path
    end

    it "returns nil for associated locales" do
      # clears any in-memory translations
      I18n.backend.reload!

      expect(described_class.all).to include({ cy: nil, en: nil })
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_translation_manager-1.8.0 spec/rails_translation_manager/locale_checker/plural_forms_spec.rb
rails_translation_manager-1.7.0 spec/rails_translation_manager/locale_checker/plural_forms_spec.rb
rails_translation_manager-1.6.3 spec/rails_translation_manager/locale_checker/plural_forms_spec.rb
rails_translation_manager-1.6.2 spec/rails_translation_manager/locale_checker/plural_forms_spec.rb
rails_translation_manager-1.6.1 spec/rails_translation_manager/locale_checker/plural_forms_spec.rb
rails_translation_manager-1.6.0 spec/rails_translation_manager/locale_checker/plural_forms_spec.rb