Sha256: f3e0cb1d7b6c4b88f4ea2961595e501b65cdd680a681247b3b0303ac0e56273d

Contents?: true

Size: 776 Bytes

Versions: 4

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true
require_relative "spec_helper"
RSpec.describe "to_russian_word" do
  context "#to_word" do
    it "converts 1 to `one`" do
      expect(1.to_russian_words).to eq("один")
    end

    it "converts '1' to `one`" do
      expect("1".to_russian_words).to eq("один")
    end

    it "raises error for non-numerical string '1d'" do
      expect { "1d".to_russian_words }.to raise_error "A whole number is expected"
    end

    it "raises error for non-numerical string 'd1'" do
      expect { "d1".to_russian_words }.to raise_error "A whole number is expected"
    end

    it "it extends Fixnum / Integer methods" do
      # Fixnum before Ruby 2.4, Integer from Ruby 2.4
      expect(1.methods).to include :to_russian_words
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
to_russian_words-1.1.4 spec/to_russiam_words_spec.rb
to_russian_words-1.1.3 spec/to_russiam_words_spec.rb
to_russian_words-1.1.2 spec/to_russiam_words_spec.rb
to_russian_words-1.1.1 spec/to_russiam_words_spec.rb