Permalink
Browse files

add range specs

  • Loading branch information...
1 parent 1853ef2 commit 31a7f0789a6a1dc5eb15ee75d4e611a3992a5e52 @olbrich committed Feb 3, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 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.