Sha256: 38ddfff6f69dfe9b144544735116123927eead944e775a751e9da5dea162481e

Contents?: true

Size: 982 Bytes

Versions: 3

Compression:

Stored size: 982 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

describe Measurement do
  describe 'cubic meters' do
    subject { Measurement.parse('1 m³') }
    
    it 'converts to cubic decimeters' do
      subject.convert_to(:dm3).quantity.should eq 1_000
    end
    
    it 'converts to cubic centimeters' do
      subject.convert_to(:cm3).quantity.should eq 1_000_000
    end
  end
  
  describe 'cubic decimeters' do
    subject { Measurement.parse('1000 dm³') }
    
    it 'converts to cubic meters' do
      subject.convert_to(:m3).quantity.should eq 1
    end
    
    it 'converts to cubic centimeters' do
      subject.convert_to(:cm3).quantity.should eq 1_000_000
    end
  end
  
  describe 'cubic centimeters' do
    subject { Measurement.parse('1000000 cm³') }
    
    it 'converts to cubic meters' do
      subject.convert_to(:m3).quantity.should eq 1
    end
    
    it 'converts to cubic decimeters' do
      subject.convert_to(:dm3).quantity.should eq 1_000
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-measurement-1.2.1 spec/ruby-measurement/definitions/metric/capacity_spec.rb
ruby-measurement-1.2.0 spec/ruby-measurement/definitions/metric/capacity_spec.rb
ruby-measurement-1.1.0 spec/ruby-measurement/definitions/metric/capacity_spec.rb