Sha256: 02d7ec4970fe151092bab9c36158d7dd61a7ef99e08e799fcf71fc43549ec156
Contents?: true
Size: 1005 Bytes
Versions: 3
Compression:
Stored size: 1005 Bytes
Contents
require File.dirname(__FILE__) + '/spec_helper' require 'rext/time' describe Time do describe "helpers" do describe "#in_words_since" do it "should convert time lost to words" do event = Time.now - 5.seconds event.in_words_since_now.should == 'less than one minute' event -= 1.minute event.in_words_since_now.should == 'one minute' event -= 2.minutes event.in_words_since_now.should == '3 minutes' event -= 5.years event.in_words_since_now.should == '5 years' event -= 100.years event.in_words_since_now.should be_nil event = Date.parse 'may 25 1987' event.in_words_since_now.should == '22 years' event.in_words_since(Date.parse('may 25 1989')).should == '2 years' event = DateTime.parse 'may 25th 1987' event.in_words_since_now.should == '22 years' event.in_words_since(Date.parse('may 25 1989')).should == '2 years' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rext-0.7.0 | spec/time_spec.rb |
rext-0.6.2 | spec/time_spec.rb |
rext-0.6.1 | spec/time_spec.rb |