Sha256: e6b8355ad51944c8e7fe22cb2b027d513f710a172b668fb5945cb6e260df0258

Contents?: true

Size: 814 Bytes

Versions: 7

Compression:

Stored size: 814 Bytes

Contents

require 'spec_helper'

describe Danica::Variable do
  it_behaves_like 'an object that respond to basic_methods'

  it_behaves_like 'an object with basic operation' do
    subject { described_class.new(value: 100) }
  end

  describe '#to_f' do
    context 'when variable has no value' do
      it { expect { subject.to_f }.to raise_error(Danica::Exception::NotDefined) }
    end

    context 'when variable has value' do
      let(:value) { 100 }
      subject { described_class.new(value: value) }

      it 'returns the value' do
        expect(subject.to_f).to eq(value)
      end
    end
  end

  describe '#to_tex' do
    it_behaves_like 'a variable method to formated string', :to_tex, :latex
  end

  describe '#to_gnu' do
    it_behaves_like 'a variable method to formated string', :to_gnu, :gnu
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
danica-2.2.1 spec/lib/danica/variable_spec.rb
danica-2.2.0 spec/lib/danica/variable_spec.rb
danica-2.1.1 spec/lib/danica/variable_spec.rb
danica-2.1.0 spec/lib/danica/variable_spec.rb
danica-2.0.6 spec/lib/danica/variable_spec.rb
danica-2.0.5 spec/lib/danica/variable_spec.rb
danica-2.0.4 spec/lib/danica/variable_spec.rb