Sha256: 5079ce32994c6bf1b50727c452fc90829387be03ec4bc61a548f2e249f10d81a

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

# coding: utf-8

#==============================================================================#
# $Id: test_date.rb 120 2009-02-09 08:22:25Z 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
kagemusha-0.0.8 test/test_date.rb