Sha256: a2d9622d2306e9f09f0195f6f0b77d974f72e2dcadc639f1814a49185f02a596

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

require 'minitest/autorun'
require 'helper'

class TestTimeLordTime < MiniTest::Unit::TestCase
  def setup
    @timestamp = Time.now
  end

  def test_to_words_past_seconds
    expected = "50 seconds ago"
    actual = TimeLord::Time.new(@timestamp - 50).period.to_words
    assert_equal(expected, actual)
  end

  def test_to_words_singular
    expected = "1 minute ago"
    actual = TimeLord::Time.new(@timestamp - 60).period.to_words
    assert_equal(expected, actual)
  end

  def test_to_words_future_days
    expected = "2 days ago"
    actual = TimeLord::Time.new(@timestamp - 172800).period.to_words
    assert_equal(expected, actual)
  end

  def test_to_words_future_days
    expected = "2 days from now"
    actual = TimeLord::Time.new(@timestamp + 172800).period.to_words
    assert_equal(expected, actual)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
time-lord-1.0.1 test/lib/time-lord/time_test.rb