Sha256: 8cdbc9144a5a77b65fa3c269a2447d1a48a382cd2a7b4bf946731d399ba4db74

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

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

1 entries across 1 versions & 1 rubygems

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