Sha256: 130f6f0e0669783bf47f8dbd4933c14dd5fd46ae6e86e79320129e705d3cd2b3

Contents?: true

Size: 996 Bytes

Versions: 2

Compression:

Stored size: 996 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

RSpec.describe Measurement do
  describe 'cubic meters' do
    subject { described_class.parse('1 m³') }

    it 'converts to cubic decimeters' do
      expect(subject.convert_to(:dm3).quantity).to eq 1_000
    end

    it 'converts to cubic centimeters' do
      expect(subject.convert_to(:cm3).quantity).to eq 1_000_000
    end
  end

  describe 'cubic decimeters' do
    subject { described_class.parse('1000 dm³') }

    it 'converts to cubic meters' do
      expect(subject.convert_to(:m3).quantity).to eq 1
    end

    it 'converts to cubic centimeters' do
      expect(subject.convert_to(:cm3).quantity).to eq 1_000_000
    end
  end

  describe 'cubic centimeters' do
    subject { described_class.parse('1000000 cm³') }

    it 'converts to cubic meters' do
      expect(subject.convert_to(:m3).quantity).to eq 1
    end

    it 'converts to cubic decimeters' do
      expect(subject.convert_to(:dm3).quantity).to eq 1_000
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-measurement-1.3.0 spec/ruby-measurement/definitions/metric/capacity_spec.rb
ruby-measurement-1.2.3 spec/ruby-measurement/definitions/metric/capacity_spec.rb