Refactoring out the unit conversion to its own place

This commit is contained in:
Andy Meneely
2015-02-01 23:48:09 -05:00
parent 4ecbaa4e31
commit 1896689614
3 changed files with 45 additions and 6 deletions
+22
View File
@@ -0,0 +1,22 @@
require 'spec_helper'
require 'squib/args/unit_conversion'
describe Squib::Args::UnitConversion do
it 'does nothing on just numbers' do
expect(subject.parse(20)).to eq(20)
end
it 'strips trailing whitespace' do
expect(subject.parse('1in ')).to eq(300)
end
it 'is ok w/internal whitesapce' do
expect(subject.parse('1 in')).to eq(300)
end
it 'does cm' do
expect(subject.parse('1cm')).to eq(118.1102361)
end
end