Sha256: 6d32ca3d9c4139bcc9d4517d2842300ae0cd7376c24e9f72637cb96767c3e099

Contents?: true

Size: 510 Bytes

Versions: 3

Compression:

Stored size: 510 Bytes

Contents

# frozen_string_literal: false

require 'spec_helper'

describe Rational do
  describe 'monkey patches' do
    it 'should render a simplified fraction as an Array' do
      expect(Rational(4, 3).to_simplified_a).to eql([1, Rational(1, 3)])
    end

    it 'should render a proper fraction as String' do
      expect(Rational(2, 3).to_simplified_a).to eql('2/3')
    end

    it 'should render a simplified fraction as a String' do
      expect(Rational(4, 3).to_simplified_s).to eql('1 1/3')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
usps_flags-0.5.0 spec/rational_spec.rb
usps_flags-0.4.1 spec/rational_spec.rb
usps_flags-0.4.0 spec/rational_spec.rb