Sha256: 0483ec41d935c5706e249a11480f0950ff0918b0f898ef58bd268ffe9b641f67

Contents?: true

Size: 1.18 KB

Versions: 18

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

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

  it_behaves_like 'an object that respond to basic_methods'
  it_behaves_like 'an object with basic operation'

  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 positive negative string' do
        expect(subject.to_tex).to eq('\pm 10')
      end
    end

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

      it 'returns the positive negative string' do
        expect(subject.to_tex).to eq('\pm 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

18 entries across 18 versions & 1 rubygems

Version Path
danica-2.7.4 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.7.3 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.7.2 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.7.1 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.6.4 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.6.3 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.6.2 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.6.1 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.6.0 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.5.1 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.5.0 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.4.4 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.4.3 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.4.2 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.4.1 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.4.0 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.3.1 spec/lib/danica/wrapper/plus_minus_spec.rb
danica-2.3.0 spec/lib/danica/wrapper/plus_minus_spec.rb