class ActiveModel::Type::DateTest

Public Instance Methods

test_type_cast_date() click to toggle source
# File activemodel/test/cases/type/date_test.rb, line 9
def test_type_cast_date
  type = Type::Date.new
  assert_nil type.cast(nil)
  assert_nil type.cast("")
  assert_nil type.cast(" ")
  assert_nil type.cast("ABC")

  date_string = ::Time.now.utc.strftime("%F")
  assert_equal date_string, type.cast(date_string).strftime("%F")
end