Sha256: 576f6cb386e8ad14627ba7a29dd5252d0fa4455c2836a153fe9be538c6bf9842

Contents?: true

Size: 1.2 KB

Versions: 11

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

RSpec.describe Humanize, 'ru locale' do
  before do
    Humanize.configure do |config|
      config.default_locale = :ru
    end
  end

  tests = [
    [1, 'один'],
    [11, 'одиннадцать'],
    [102, 'сто два'],
    [678, 'шестьсот семьдесят восемь'],
    [876, 'восемьсот семьдесят шесть'],
    [1000, 'одна тысяча'],
    [2000, 'две тысячи'],
    [5000, 'пять тысяч'],
    [202_000, "двести две тысячи"],
    [1_000_000, 'один миллион'],
    [2_000_000, 'два миллиона'],
    [3_000_000, 'три миллиона'],
    [5_000_000, 'пять миллионов']
  ]

  tests.each do |num, output|
    it "#{num} equals #{output}" do
      expect(num.humanize).to eql(output)
    end
  end

  describe 'when called on conceptual number' do
    it 'reads correctly' do
      inf = Float::INFINITY
      neg_inf = - inf
      nan = inf + neg_inf

      expect(inf.humanize).to eq('бесконечность')
      expect(neg_inf.humanize).to eq('минус бесконечность')
      expect(nan.humanize).to eq('неопределенность')
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
humanize-3.0.0 spec/locales/ru_spec.rb
humanize-2.5.1 spec/locales/ru_spec.rb
humanize-2.5.0 spec/locales/ru_spec.rb
humanize-2.4.3 spec/locales/ru_spec.rb
humanize-2.4.2 spec/locales/ru_spec.rb
humanize-2.4.1 spec/locales/ru_spec.rb
humanize-2.4.0 spec/locales/ru_spec.rb
humanize-2.3.0 spec/locales/ru_spec.rb
humanize-2.2.1 spec/locales/ru_spec.rb
humanize-2.2.0 spec/locales/ru_spec.rb
humanize-2.1.2 spec/locales/ru_spec.rb