Permalink
Browse files

add time specs for .to_unit

  • Loading branch information...
1 parent b14ca88 commit f98403018aa001c100d79add0fb27d7283ab7301 @olbrich committed Feb 25, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 spec/ruby-units/time_spec.rb
@@ -17,6 +17,14 @@
specify { Time.in("5 min").should > Time.now}
end
+ context '#to_unit' do
+ subject { now }
+ its(:to_unit) { should be_an_instance_of(Unit) }
+ its('to_unit.units') { should == "s" }
+ specify { subject.to_unit('h').kind.should == :time}
+ specify { subject.to_unit('h').units.should == 'h'}
+ end
+
context 'addition (+)' do
specify { (Time.now + 1).should == Time.at(1303656390 + 1)}
specify { (Time.now + Unit("10 min")).should == Time.at(1303656390 + 600)}

0 comments on commit f984030

Please sign in to comment.