Sha256: 72771832c35dff225535e13b90533116c504b68a6c8045c8b4198705ca3abbe7

Contents?: true

Size: 850 Bytes

Versions: 13

Compression:

Stored size: 850 Bytes

Contents

require 'test_helper'

# This tests our Ourtime class
class OurtimeTest < Minitest::Test
  def test_initialize_with_local_format_string
    # Creating an Ourtime from a local-format String (with seconds)
    ot = Ourtime.new('01.02.1993 04:05:06')
    assert_equal '1993-02-01 04:05:06', ot.thetime.strftime('%Y-%m-%d %H:%M:%S')
    assert_kind_of Time, ot.thetime
  end

  def test_initialize_with_time
    # Creating an Ourtime from a Time
    ot = Ourtime.new(Time.mktime(1993, 2, 1, 4, 5))
    assert_equal '01.02.1993 04:05', ot.to_s
  end

  def test_initialize_with_no_parameters
    assert Ourtime.new.blank?  # delegates to empty?
  end

  def test_initialize_with_iso_string
    # Parsing an ISO datetime
    ot = Ourtime.new('1993-04-05 06:07:08')
    assert_equal '1993-04-05 06:07:08', ot.thetime.strftime('%Y-%m-%d %H:%M:%S')
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ndr_support-5.3.0 test/ourtime_test.rb
ndr_support-5.2.0 test/ourtime_test.rb
ndr_support-5.1.0 test/ourtime_test.rb
ndr_support-4.2.0 test/ourtime_test.rb
ndr_support-5.0.0 test/ourtime_test.rb
ndr_support-4.1.2 test/ourtime_test.rb
ndr_support-4.1.1 test/ourtime_test.rb
ndr_support-4.0.1 test/ourtime_test.rb
ndr_support-4.0.0 test/ourtime_test.rb
ndr_support-3.3.0 test/ourtime_test.rb
ndr_support-3.2.1 test/ourtime_test.rb
ndr_support-3.2.0 test/ourtime_test.rb
ndr_support-3.1.1 test/ourtime_test.rb