File: process_title_updater_test.rb

package info (click to toggle)
ruby-spring 2.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 428 kB
  • sloc: ruby: 3,373; sh: 9; makefile: 7
file content (24 lines) | stat: -rw-r--r-- 770 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require_relative "../helper"
require "spring/process_title_updater"
require "active_support/time"

class ProcessTitleUpdaterTest < ActiveSupport::TestCase
  setup do
    @start   = Time.local(2012, 2, 12, 4, 3, 12)
    @updater = Spring::ProcessTitleUpdater.new(@start) { }
  end

  test "seconds" do
    assert_equal "1 sec",  @updater.distance_in_words(@start + 1.second)
    assert_equal "2 secs", @updater.distance_in_words(@start + 2.seconds)
  end

  test "minutes" do
    assert_equal "1 min",  @updater.distance_in_words(@start + 1.minute + 10.seconds)
    assert_equal "5 mins", @updater.distance_in_words(@start + 5.minutes + 10.seconds)
  end

  test "hours" do
    assert_equal "6 hours",  @updater.distance_in_words(@start + 6.hours + 50.minutes)
  end
end