Sha256: 09e14899b07da7fa61e87829fb407eeff7bbb53067e891db1c72e71200ff09c6

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

# coding: utf-8

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

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

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

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

  def test_on
    musha1 = Kagemusha::Date.on(2007, 1, 2)
    assert_equal(Date, musha1.instance_eval { @klass })
    musha1.swap {
      assert_equal(Date.new(2007, 1, 2), Date.today)
    }

    musha2 = Kagemusha::Date.on(Date.new(1984, 5, 11))
    musha2.swap {
      assert_equal(Date.new(1984, 5, 11), Date.today)
    }

    assert_raise(ArgumentError) {
      Kagemusha::Date.on(:symbol)
    }
  end

  def test_on_with_block
    ret = Kagemusha::Date.on(2007, 1, 2) {
      assert_equal(Date.new(2007, 1, 2), Date.today)
      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_date.rb