Sha256: 2907d267659e90fa9f502ab4c0006ecafe36a86b13ad4f8b094e06ed57374b38

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 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, 'одиннадцать'],
    [1000, 'одна тысяча'],
    [2000, 'две тысячи'],
    [5000, 'пять тысяч'],
    [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

2 entries across 2 versions & 1 rubygems

Version Path
humanize-2.1.1 spec/locales/ru_spec.rb
humanize-2.1.0 spec/locales/ru_spec.rb