Sha256: f150b14ff98210f5b2f48445b556758ae557c3d3f4399d25abbe9b4d1122cb1c
Contents?: true
Size: 1004 Bytes
Versions: 2
Compression:
Stored size: 1004 Bytes
Contents
require 'spec_helper' describe String do describe '#to_measurement' do describe 'with valid quantity' do subject { '3' } specify { subject.to_measurement.should eq Measurement.new(3) } end describe 'with valid quantity and unit' do subject { '3 dozen' } specify { subject.to_measurement.should 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 { subject.to_unit.should 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-measurement-1.2.1 | spec/ruby-measurement/core_ext/string_spec.rb |
ruby-measurement-1.2.0 | spec/ruby-measurement/core_ext/string_spec.rb |