Sha256: ebc472383599118cc087ed062a3f592e669aeefdfb2f06c655f11b0a79b35f7f

Contents?: true

Size: 849 Bytes

Versions: 2

Compression:

Stored size: 849 Bytes

Contents

require 'spec_helper'

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

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

      it { expect(subject.to_f).to eq(value) }
    end
  end

  describe 'to_tex' do
    let(:name) { :delta }

    context 'when latex is not defined ' do
      let(:subject) { described_class.new name: name }

      it 'returns name' do
        expect(subject.to_tex).to eq('delta')
      end
    end

    context 'when latex has been defined' do
      let(:subject) { described_class.new name: name, latex: '\delta' }

      it 'returns latex' do
        expect(subject.to_tex).to eq('\delta')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danica-0.2.0 spec/lib/danica/variable_spec.rb
danica-0.1.0 spec/lib/danica/variable_spec.rb