Sha256: 5d5e03d353214564636769c973f97d4e4df3cb0bfc8c6f3fa89bf9e866bb0191

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 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

2 entries across 2 versions & 1 rubygems

Version Path
visionmedia-rext-0.0.2 spec/time_spec.rb
visionmedia-rext-0.0.3 spec/time_spec.rb