Sha256: aeb9392b45bc193bbd2c251cb29eb98638d8dd5439114f2a321c520d97c0622d
Contents?: true
Size: 1004 Bytes
Versions: 1
Compression:
Stored size: 1004 Bytes
Contents
require 'spec_helper' RSpec.describe String do describe '#to_measurement' do describe 'with valid quantity' do subject { '3' } specify { expect(subject.to_measurement).to eq Measurement.new(3) } end describe 'with valid quantity and unit' do subject { '3 dozen' } specify { expect(subject.to_measurement).to eq Measurement.new(3, :dozen) } end describe 'with valid quantity and invalid unit' do subject { '3 people' } specify { expect { subject.to_measurement }.to raise_error } end describe 'with invalid input' do subject { 'foobar' } specify { expect { subject.to_measurement }.to raise_error } end end describe '#to_unit' do describe 'with valid unit' do subject { 'dozen' } specify { expect(subject.to_unit).to eq Measurement::Unit[:dozen] } end describe 'with invalid unit' do subject { 'person' } specify { expect { subject.to_unit }.to raise_error } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-measurement-1.2.3 | spec/ruby-measurement/core_ext/string_spec.rb |