Sha256: 0ec90e7f79a66934cb0016bb7c9066d50a79f379980151f8196a42ae87ff6292

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

#==============================================================================#
# $Id: test_date.rb 37 2007-08-27 13:02: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

6 entries across 6 versions & 1 rubygems

Version Path
kagemusha-0.0.7 test/test_date.rb
kagemusha-0.0.2 test/test_date.rb
kagemusha-0.0.3 test/test_date.rb
kagemusha-0.0.4 test/test_date.rb
kagemusha-0.0.5 test/test_date.rb
kagemusha-0.0.6 test/test_date.rb