Sha256: 7b1871839ed6821432f8ebd400d78bc4ee921c38b45deecdb4351e1dd95ba230

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

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

  it_behaves_like 'an object that respond to basic_methods'

  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 float' do
      let(:value) { 10.5 }

      it 'returns the value float 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 a float' do
      let(:value) { 10.5 }

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danica-2.0.6 spec/lib/danica/negative_spec.rb
danica-2.0.5 spec/lib/danica/negative_spec.rb
danica-2.0.4 spec/lib/danica/negative_spec.rb