spec/timespan_spec.rb in timespan-0.1.3 vs spec/timespan_spec.rb in timespan-0.1.4

- old
+ new

@@ -28,9 +28,26 @@ it 'should be 3 days' do timespan.to_d.should == 3 end end + describe 'set duration with String' do + let(:timespan) { TimeSpan.new :from => from, :duration => "3 days" } + + it 'should be 3 days' do + timespan.to_d.should == 3 + end + end + + describe 'set duration with Spanner String including and' do + let(:timespan) { TimeSpan.new :from => from, :duration => "3 days and 2 hours" } + + it 'should be 3 days and 2 hrs' do + timespan.to_h.should == (24 * 3) + 2 + end + end + + describe 'set start_time to new' do let(:timespan) { TimeSpan.new :from => from, :to => to } before :each do @old_timespan = timespan.clone