Sha256: 857406e2cb04abd8d0c04533297bbd2c5898f23fe3380c5b2401673bd50871e8

Contents?: true

Size: 1.03 KB

Versions: 30

Compression:

Stored size: 1.03 KB

Contents

require 'helper'

class TestRepeaterMinute < TestCase

  def setup
    @now = Time.local(2008, 6, 25, 7, 15, 30, 0)
  end

  def test_next_future
    minutes = Chronic::RepeaterMinute.new(:minute)
    minutes.start = @now

    next_minute = minutes.next(:future)
    assert_equal Time.local(2008, 6, 25, 7, 16), next_minute.begin
    assert_equal Time.local(2008, 6, 25, 7, 17), next_minute.end

    next_next_minute = minutes.next(:future)
    assert_equal Time.local(2008, 6, 25, 7, 17), next_next_minute.begin
    assert_equal Time.local(2008, 6, 25, 7, 18), next_next_minute.end
  end

  def test_next_past
    minutes = Chronic::RepeaterMinute.new(:minute)
    minutes.start = @now

    prev_minute = minutes.next(:past)
    assert_equal Time.local(2008, 6, 25, 7, 14), prev_minute.begin
    assert_equal Time.local(2008, 6, 25, 7, 15), prev_minute.end

    prev_prev_minute = minutes.next(:past)
    assert_equal Time.local(2008, 6, 25, 7, 13), prev_prev_minute.begin
    assert_equal Time.local(2008, 6, 25, 7, 14), prev_prev_minute.end
  end
end

Version data entries

30 entries across 30 versions & 7 rubygems

Version Path
Hokkaido-0.0.4 chronic/test/test_repeater_minute.rb
chronic-0.8.0 test/test_repeater_minute.rb
chronic-0.7.0 test/test_repeater_minute.rb
chronic_2001-0.1.5 test/test_repeater_minute.rb
chronic_2001-0.1.4 test/test_repeater_minute.rb
chronic_2001-0.1.3 test/test_repeater_minute.rb
chronic_2001-0.1.2 test/test_repeater_minute.rb
chronic_2001-0.1.1 test/test_repeater_minute.rb
chronic_2001-0.1.0 test/test_repeater_minute.rb
chronic_2011-0.1.0 test/test_repeater_minute.rb