Sha256: 08576fb3a58537e06a051347182ef4f3af1081e0051352012127eedc0209a221

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe Danica::Number do
  let(:value) { 10 }
  let(:subject) { described_class.new(value) }

  describe '#to_f' do
    it 'returns the float of value' do
      expect(subject.to_f).to eq(10)
    end

    it { expect(subject.to_f).to be_a(Float) }
  end

  describe '#to_tex' do
    context 'when value should be integer' do
      let(:value) { 10.0 }

      it 'returns the value integer string' do
        expect(subject.to_tex).to eq('10')
      end
    end

    context 'when value should be integer' do
      let(:value) { 10.5 }

      it 'returns the value integer string' do
        expect(subject.to_tex).to eq('10.5')
      end
    end
  end

  describe '#to_gnu' do
    context 'when value should be integer' do
      let(:value) { 10.0 }

      it 'returns the value integer string' do
        expect(subject.to_gnu).to eq('10')
      end
    end

    context 'when value should be integer' do
      let(:value) { 10.5 }

      it 'returns the value integer string' do
        expect(subject.to_gnu).to eq('10.5')
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
danica-2.0.1 spec/lib/danica/number_spec.rb
danica-2.0.0 spec/lib/danica/number_spec.rb
danica-1.2.0 spec/lib/danica/number_spec.rb
danica-1.1.0 spec/lib/danica/number_spec.rb
danica-1.0.0 spec/lib/danica/number_spec.rb