Sha256: 454bc282cf6485f6b39a2a5a5789adf8bf46a84dc67abfc7117e4146e564fd9c

Contents?: true

Size: 914 Bytes

Versions: 4

Compression:

Stored size: 914 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Datet" do
  it "should be able to make ago-strings" do
    require "knj/datet"
    
    time = Time.at(Time.now.to_i - 5)
    datet = Knj::Datet.in(time)
    res = datet.ago_str
    raise "Expected '5 seconds ago' but got: '#{res}'." if res != "5 seconds ago"
    
    
    time = Time.at(Time.now.to_i - 1800)
    datet = Knj::Datet.in(time)
    res = datet.ago_str
    raise "Expected '30 minutes ago' but got: '#{res}'." if res != "30 minutes ago"
    
    
    time = Time.at(Time.now.to_i - 60)
    datet = Knj::Datet.in(time)
    res = datet.ago_str
    raise "Expected '1 minute ago' but got: '#{res}'." if res != "1 minute ago"
    
    
    time = Time.at(Time.now.to_i - 48 * 3600)
    datet = Knj::Datet.in(time)
    res = datet.ago_str
    raise "Expected '48 hours ago' but got: '#{res}'." if res != "48 hours ago"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
knjrbfw-0.0.27 spec/datet_spec.rb
knjrbfw-0.0.26 spec/datet_spec.rb
knjrbfw-0.0.25 spec/datet_spec.rb
knjrbfw-0.0.24 spec/datet_spec.rb