Sha256: 8f0782ee032a1a9b2594a41732027ac0633261b8fc041ae8860c60376bcc7719

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# coding: utf-8

#==============================================================================#
# $Id: test_time.rb 108 2009-02-09 06:04:39Z yuyakato $
#==============================================================================#

require File.dirname(__FILE__) + "/test_helper.rb"
require File.dirname(__FILE__) + "/../lib/kagemusha/time"

#==============================================================================#

class TestKagemushaTime < Test::Unit::TestCase
  def setup
  end

  def test_at
    musha1 = Kagemusha::Time.at(2007, 1, 2, 3, 4, 5)
    assert_equal(Time, musha1.instance_eval { @klass })
    musha1.swap {
      assert_equal(Time.local(2007, 1, 2, 3, 4, 5), Time.now)
    }

    musha2 = Kagemusha::Time.at(Time.local(1984, 5, 11))
    musha2.swap {
      assert_equal(Time.local(1984, 5, 11), Time.now)
    }

    assert_raise(ArgumentError) {
      Kagemusha::Time.at(:symbol)
    }
  end

  def test_at_with_block
    ret = Kagemusha::Time.at(2007, 1, 2, 3, 4, 5) {
      assert_equal(Time.local(2007, 1, 2, 3, 4, 5), Time.now)
      1
    }

    assert_equal(1, ret)
  end
end

#==============================================================================#
#==============================================================================#

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nayutaya-kagemusha-0.0.9 test/test_time.rb