Sha256: 43564775782bceb31d4c3e6d8cbf7922c5490f4012e01497f2634b52cfe42b96

Contents?: true

Size: 1.33 KB

Versions: 38

Compression:

Stored size: 1.33 KB

Contents

# encoding: utf-8

module I18n
  module Tests
    module Pluralization
      test "pluralization: given 0 it returns the :zero translation if it is defined" do
        assert_equal 'zero', I18n.t(:default => { :zero => 'zero' }, :count => 0)
      end

      test "pluralization: given 0 it returns the :other translation if :zero is not defined" do
        assert_equal 'bars', I18n.t(:default => { :other => 'bars' }, :count => 0)
      end

      test "pluralization: given 1 it returns the singular translation" do
        assert_equal 'bar', I18n.t(:default => { :one => 'bar' }, :count => 1)
      end

      test "pluralization: given 2 it returns the :other translation" do
        assert_equal 'bars', I18n.t(:default => { :other => 'bars' }, :count => 2)
      end

      test "pluralization: given 3 it returns the :other translation" do
        assert_equal 'bars', I18n.t(:default => { :other => 'bars' }, :count => 3)
      end

      test "pluralization: given nil it returns the whole entry" do
        assert_equal({ :one => 'bar' }, I18n.t(:default => { :one => 'bar' }, :count => nil))
      end

      test "pluralization: given incomplete pluralization data it raises I18n::InvalidPluralizationData" do
        assert_raises(I18n::InvalidPluralizationData) { I18n.t(:default => { :one => 'bar' }, :count => 2) }
      end
    end
  end
end

Version data entries

38 entries across 33 versions & 13 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.6/lib/i18n/tests/pluralization.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/i18n-1.14.6/lib/i18n/tests/pluralization.rb
i18n-1.14.7 lib/i18n/tests/pluralization.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.5/lib/i18n/tests/pluralization.rb
i18n-1.14.6 lib/i18n/tests/pluralization.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.5/lib/i18n/tests/pluralization.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/tests/pluralization.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/tests/pluralization.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/tests/pluralization.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/lib/i18n/tests/pluralization.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/lib/i18n/tests/pluralization.rb
i18n-1.14.5 lib/i18n/tests/pluralization.rb
i18n-1.14.4 lib/i18n/tests/pluralization.rb
i18n-1.14.3 lib/i18n/tests/pluralization.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/tests/pluralization.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/tests/pluralization.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.14.1/lib/i18n/tests/pluralization.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.10.0/lib/i18n/tests/pluralization.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.12.0/lib/i18n/tests/pluralization.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/tests/pluralization.rb