Sha256: 199ea2f76c95da2af170350935ab82b5ec57c51dff9953aa71d7252559a5f17a

Contents?: true

Size: 776 Bytes

Versions: 9

Compression:

Stored size: 776 Bytes

Contents

require 'test_helper'

# This tests our Ourdate class
class OurdateTest < Minitest::Test
  def test_date_and_time
    d = Ourdate.build_datetime(2003, 11, 30)
    assert_equal '30 November 2003', d.to_verbose
    assert_equal '2003-11-30', d.to_iso
    assert_equal '30.11.2003', d.to_ours
    assert_equal '30.11.2003', d.to_s
  end

  def test_ourdate
    # Creating an Ourdate from a String
    od = Ourdate.new('01.02.2000')
    assert_equal Date.new(2000, 2, 1).to_s(:ui), od.to_s
    assert_kind_of Date, od.thedate
    assert_equal '01.02.2000', od.thedate.to_s
    # Creating an Ourdate from a Date
    od = Ourdate.new(Date.new(2000, 3, 1))
    assert_equal '01.03.2000', od.to_s
  end

  def test_blank
    assert Ourdate.new.blank?  # delegates to empty?
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ndr_support-4.2.0 test/ourdate_test.rb
ndr_support-4.1.2 test/ourdate_test.rb
ndr_support-4.1.1 test/ourdate_test.rb
ndr_support-4.0.1 test/ourdate_test.rb
ndr_support-4.0.0 test/ourdate_test.rb
ndr_support-3.3.0 test/ourdate_test.rb
ndr_support-3.2.1 test/ourdate_test.rb
ndr_support-3.2.0 test/ourdate_test.rb
ndr_support-3.1.1 test/ourdate_test.rb