Skip to content

Commit

Permalink
add range specs
Browse files Browse the repository at this point in the history
  • Loading branch information
olbrich committed Feb 3, 2012
1 parent 1853ef2 commit 31a7f07
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/ruby-units/range_spec.rb
@@ -0,0 +1,16 @@
require File.dirname(__FILE__) + '/../spec_helper'

describe "Range" do

context "of integer units" do
subject { (Unit('1 mm')..Unit('3 mm')) }
it { should include(Unit('2 mm')) }
its(:to_a) { should == [ Unit('1 mm'), Unit('2 mm'), Unit('3 mm') ] }
end

context "of floating point units" do
subject { (Unit('1.5 mm')..Unit('3.5 mm')) }
it { should include(Unit('2.0 mm')) }
specify { expect { subject.to_a }.to raise_exception(ArgumentError)}
end
end

0 comments on commit 31a7f07

Please sign in to comment.