spec/ruby-measurement/definitions/metric/weight_spec.rb in ruby-measurement-1.2.1 vs spec/ruby-measurement/definitions/metric/weight_spec.rb in ruby-measurement-1.2.2
- old
+ new
@@ -1,325 +1,325 @@
# encoding: UTF-8
require 'spec_helper'
-describe Measurement do
+RSpec.describe Measurement do
describe 'tonnes' do
- subject { Measurement.parse('0.001 tonne') }
+ subject { described_class.parse('0.001 tonne') }
it 'converts to hectograms' do
- subject.convert_to(:hg).quantity.should eq 10
+ expect(subject.convert_to(:hg).quantity).to eq 10
end
it 'converts to dekagrams' do
- subject.convert_to(:dag).quantity.should eq 100
+ expect(subject.convert_to(:dag).quantity).to eq 100
end
it 'converts to grams' do
- subject.convert_to(:g).quantity.should eq 1_000
+ expect(subject.convert_to(:g).quantity).to eq 1_000
end
it 'converts to decigrams' do
- subject.convert_to(:dg).quantity.should eq 10_000
+ expect(subject.convert_to(:dg).quantity).to eq 10_000
end
it 'converts to centigrams' do
- subject.convert_to(:cg).quantity.should eq 100_000
+ expect(subject.convert_to(:cg).quantity).to eq 100_000
end
it 'converts to milligrams' do
- subject.convert_to(:mg).quantity.should eq 1_000_000
+ expect(subject.convert_to(:mg).quantity).to eq 1_000_000
end
it 'converts to micrograms' do
- subject.convert_to(:µg).quantity.should eq 10_000_000
+ expect(subject.convert_to(:µg).quantity).to eq 10_000_000
end
end
describe 'kilograms' do
- subject { Measurement.parse('1 kg') }
+ subject { described_class.parse('1 kg') }
it 'converts to tonnes' do
- subject.convert_to(:t).quantity.should eq 0.001
+ expect(subject.convert_to(:t).quantity).to eq 0.001
end
it 'converts to hectograms' do
- subject.convert_to(:hg).quantity.should eq 10
+ expect(subject.convert_to(:hg).quantity).to eq 10
end
it 'converts to dekagrams' do
- subject.convert_to(:dag).quantity.should eq 100
+ expect(subject.convert_to(:dag).quantity).to eq 100
end
it 'converts to grams' do
- subject.convert_to(:g).quantity.should eq 1_000
+ expect(subject.convert_to(:g).quantity).to eq 1_000
end
it 'converts to decigrams' do
- subject.convert_to(:dg).quantity.should eq 10_000
+ expect(subject.convert_to(:dg).quantity).to eq 10_000
end
it 'converts to centigrams' do
- subject.convert_to(:cg).quantity.should eq 100_000
+ expect(subject.convert_to(:cg).quantity).to eq 100_000
end
it 'converts to milligrams' do
- subject.convert_to(:mg).quantity.should eq 1_000_000
+ expect(subject.convert_to(:mg).quantity).to eq 1_000_000
end
it 'converts to micrograms' do
- subject.convert_to(:µg).quantity.should eq 10_000_000
+ expect(subject.convert_to(:µg).quantity).to eq 10_000_000
end
end
describe 'hectograms' do
- subject { Measurement.parse('10 hg') }
+ subject { described_class.parse('10 hg') }
it 'converts to tonnes' do
- subject.convert_to(:t).quantity.should eq 0.001
+ expect(subject.convert_to(:t).quantity).to eq 0.001
end
it 'converts to kilograms' do
- subject.convert_to(:kg).quantity.should eq 1
+ expect(subject.convert_to(:kg).quantity).to eq 1
end
it 'converts to dekagrams' do
- subject.convert_to(:dag).quantity.should eq 100
+ expect(subject.convert_to(:dag).quantity).to eq 100
end
it 'converts to grams' do
- subject.convert_to(:g).quantity.should eq 1_000
+ expect(subject.convert_to(:g).quantity).to eq 1_000
end
it 'converts to decigrams' do
- subject.convert_to(:dg).quantity.should eq 10_000
+ expect(subject.convert_to(:dg).quantity).to eq 10_000
end
it 'converts to centigrams' do
- subject.convert_to(:cg).quantity.should eq 100_000
+ expect(subject.convert_to(:cg).quantity).to eq 100_000
end
it 'converts to milligrams' do
- subject.convert_to(:mg).quantity.should eq 1_000_000
+ expect(subject.convert_to(:mg).quantity).to eq 1_000_000
end
it 'converts to micrograms' do
- subject.convert_to(:µg).quantity.should eq 10_000_000
+ expect(subject.convert_to(:µg).quantity).to eq 10_000_000
end
end
describe 'dekagrams' do
- subject { Measurement.parse('100 dag') }
+ subject { described_class.parse('100 dag') }
it 'converts to tonnes' do
- subject.convert_to(:t).quantity.should eq 0.001
+ expect(subject.convert_to(:t).quantity).to eq 0.001
end
it 'converts to kilograms' do
- subject.convert_to(:kg).quantity.should eq 1
+ expect(subject.convert_to(:kg).quantity).to eq 1
end
it 'converts to hectograms' do
- subject.convert_to(:hg).quantity.should eq 10
+ expect(subject.convert_to(:hg).quantity).to eq 10
end
it 'converts to grams' do
- subject.convert_to(:g).quantity.should eq 1_000
+ expect(subject.convert_to(:g).quantity).to eq 1_000
end
it 'converts to decigrams' do
- subject.convert_to(:dg).quantity.should eq 10_000
+ expect(subject.convert_to(:dg).quantity).to eq 10_000
end
it 'converts to centigrams' do
- subject.convert_to(:cg).quantity.should eq 100_000
+ expect(subject.convert_to(:cg).quantity).to eq 100_000
end
it 'converts to milligrams' do
- subject.convert_to(:mg).quantity.should eq 1_000_000
+ expect(subject.convert_to(:mg).quantity).to eq 1_000_000
end
it 'converts to micrograms' do
- subject.convert_to(:µg).quantity.should eq 10_000_000
+ expect(subject.convert_to(:µg).quantity).to eq 10_000_000
end
end
describe 'grams' do
- subject { Measurement.parse('1000 g') }
+ subject { described_class.parse('1000 g') }
it 'converts to tonnes' do
- subject.convert_to(:t).quantity.should eq 0.001
+ expect(subject.convert_to(:t).quantity).to eq 0.001
end
it 'converts to kilograms' do
- subject.convert_to(:kg).quantity.should eq 1
+ expect(subject.convert_to(:kg).quantity).to eq 1
end
it 'converts to hectograms' do
- subject.convert_to(:hg).quantity.should eq 10
+ expect(subject.convert_to(:hg).quantity).to eq 10
end
it 'converts to dekagrams' do
- subject.convert_to(:dag).quantity.should eq 100
+ expect(subject.convert_to(:dag).quantity).to eq 100
end
it 'converts to decigrams' do
- subject.convert_to(:dg).quantity.should eq 10_000
+ expect(subject.convert_to(:dg).quantity).to eq 10_000
end
it 'converts to centigrams' do
- subject.convert_to(:cg).quantity.should eq 100_000
+ expect(subject.convert_to(:cg).quantity).to eq 100_000
end
it 'converts to milligrams' do
- subject.convert_to(:mg).quantity.should eq 1_000_000
+ expect(subject.convert_to(:mg).quantity).to eq 1_000_000
end
it 'converts to micrograms' do
- subject.convert_to(:µg).quantity.should eq 10_000_000
+ expect(subject.convert_to(:µg).quantity).to eq 10_000_000
end
end
describe 'decigrams' do
- subject { Measurement.parse('10000 dg') }
+ subject { described_class.parse('10000 dg') }
it 'converts to tonnes' do
- subject.convert_to(:t).quantity.should eq 0.001
+ expect(subject.convert_to(:t).quantity).to eq 0.001
end
it 'converts to kilograms' do
- subject.convert_to(:kg).quantity.should eq 1
+ expect(subject.convert_to(:kg).quantity).to eq 1
end
it 'converts to hectograms' do
- subject.convert_to(:hg).quantity.should eq 10
+ expect(subject.convert_to(:hg).quantity).to eq 10
end
it 'converts to dekagrams' do
- subject.convert_to(:dag).quantity.should eq 100
+ expect(subject.convert_to(:dag).quantity).to eq 100
end
it 'converts to grams' do
- subject.convert_to(:g).quantity.should eq 1_000
+ expect(subject.convert_to(:g).quantity).to eq 1_000
end
it 'converts to centigrams' do
- subject.convert_to(:cg).quantity.should eq 100_000
+ expect(subject.convert_to(:cg).quantity).to eq 100_000
end
it 'converts to milligrams' do
- subject.convert_to(:mg).quantity.should eq 1_000_000
+ expect(subject.convert_to(:mg).quantity).to eq 1_000_000
end
it 'converts to micrograms' do
- subject.convert_to(:µg).quantity.should eq 10_000_000
+ expect(subject.convert_to(:µg).quantity).to eq 10_000_000
end
end
describe 'centigrams' do
- subject { Measurement.parse('100000 cg') }
+ subject { described_class.parse('100000 cg') }
it 'converts to tonnes' do
- subject.convert_to(:t).quantity.should eq 0.001
+ expect(subject.convert_to(:t).quantity).to eq 0.001
end
it 'converts to kilograms' do
- subject.convert_to(:kg).quantity.should eq 1
+ expect(subject.convert_to(:kg).quantity).to eq 1
end
it 'converts to hectograms' do
- subject.convert_to(:hg).quantity.should eq 10
+ expect(subject.convert_to(:hg).quantity).to eq 10
end
it 'converts to dekagrams' do
- subject.convert_to(:dag).quantity.should eq 100
+ expect(subject.convert_to(:dag).quantity).to eq 100
end
it 'converts to grams' do
- subject.convert_to(:g).quantity.should eq 1_000
+ expect(subject.convert_to(:g).quantity).to eq 1_000
end
it 'converts to decigrams' do
- subject.convert_to(:dg).quantity.should eq 10_000
+ expect(subject.convert_to(:dg).quantity).to eq 10_000
end
it 'converts to milligrams' do
- subject.convert_to(:mg).quantity.should eq 1_000_000
+ expect(subject.convert_to(:mg).quantity).to eq 1_000_000
end
it 'converts to micrograms' do
- subject.convert_to(:µg).quantity.should eq 10_000_000
+ expect(subject.convert_to(:µg).quantity).to eq 10_000_000
end
end
describe 'milligrams' do
- subject { Measurement.parse('1000000 mg') }
+ subject { described_class.parse('1000000 mg') }
it 'converts to tonnes' do
- subject.convert_to(:t).quantity.should eq 0.001
+ expect(subject.convert_to(:t).quantity).to eq 0.001
end
it 'converts to kilograms' do
- subject.convert_to(:kg).quantity.should eq 1
+ expect(subject.convert_to(:kg).quantity).to eq 1
end
it 'converts to hectograms' do
- subject.convert_to(:hg).quantity.should eq 10
+ expect(subject.convert_to(:hg).quantity).to eq 10
end
it 'converts to dekagrams' do
- subject.convert_to(:dag).quantity.should eq 100
+ expect(subject.convert_to(:dag).quantity).to eq 100
end
it 'converts to grams' do
- subject.convert_to(:g).quantity.should eq 1_000
+ expect(subject.convert_to(:g).quantity).to eq 1_000
end
it 'converts to decigrams' do
- subject.convert_to(:dg).quantity.should eq 10_000
+ expect(subject.convert_to(:dg).quantity).to eq 10_000
end
it 'converts to centigrams' do
- subject.convert_to(:cg).quantity.should eq 100_000
+ expect(subject.convert_to(:cg).quantity).to eq 100_000
end
it 'converts to micrograms' do
- subject.convert_to(:µg).quantity.should eq 10_000_000
+ expect(subject.convert_to(:µg).quantity).to eq 10_000_000
end
end
describe 'micrograms' do
- subject { Measurement.parse('10000000 µg') }
+ subject { described_class.parse('10000000 µg') }
it 'converts to tonnes' do
- subject.convert_to(:t).quantity.should eq 0.001
+ expect(subject.convert_to(:t).quantity).to eq 0.001
end
it 'converts to kilograms' do
- subject.convert_to(:kg).quantity.should eq 1
+ expect(subject.convert_to(:kg).quantity).to eq 1
end
it 'converts to hectograms' do
- subject.convert_to(:hg).quantity.should eq 10
+ expect(subject.convert_to(:hg).quantity).to eq 10
end
it 'converts to dekagrams' do
- subject.convert_to(:dag).quantity.should eq 100
+ expect(subject.convert_to(:dag).quantity).to eq 100
end
it 'converts to grams' do
- subject.convert_to(:g).quantity.should eq 1_000
+ expect(subject.convert_to(:g).quantity).to eq 1_000
end
it 'converts to decigrams' do
- subject.convert_to(:dg).quantity.should eq 10_000
+ expect(subject.convert_to(:dg).quantity).to eq 10_000
end
it 'converts to centigrams' do
- subject.convert_to(:cg).quantity.should eq 100_000
+ expect(subject.convert_to(:cg).quantity).to eq 100_000
end
it 'converts to milligrams' do
- subject.convert_to(:mg).quantity.should eq 1_000_000
+ expect(subject.convert_to(:mg).quantity).to eq 1_000_000
end
end
end