Sha256: 8449b1893b089fb52d50bc80fcfdae61b95710c03c40873aa4a14341526b16e3

Contents?: true

Size: 607 Bytes

Versions: 8

Compression:

Stored size: 607 Bytes

Contents

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 == 'hundreds of years'
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
visionmedia-rext-0.0.4 spec/time_spec.rb
visionmedia-rext-0.0.5 spec/time_spec.rb
visionmedia-rext-0.0.6 spec/time_spec.rb
visionmedia-rext-0.0.7 spec/time_spec.rb
visionmedia-rext-0.0.8 spec/time_spec.rb
visionmedia-rext-0.1.0 spec/time_spec.rb
visionmedia-rext-0.2.1 spec/time_spec.rb
visionmedia-rext-0.2.2 spec/time_spec.rb