Sha256: 5502f17d4a6ef68344cfcdb1e55d517bc3b466ab9ccd4fea661e3eebda4b51d7
Contents?: true
Size: 784 Bytes
Versions: 8
Compression:
Stored size: 784 Bytes
Contents
require "helper" class DateValidationsTest < Test::Unit::TestCase describe "date validation with a normal string column" do class Person < Ohm::Model include Ohm::DateValidations attribute :birthday def validate assert_date :birthday end end test "accepts all canonical dates" do assert Person.new(:birthday => "2010-05-05").valid? assert Person.new(:birthday => "2010-5-5").valid? assert Person.new(:birthday => "2010-05-5").valid? assert Person.new(:birthday => "2010-5-05").valid? end test "also catches invalid dates" do assert ! Person.new(:birthday => "2010-02-29").valid? end test "invalid when empty" do assert ! Person.new(:birthday => "").valid? end end end
Version data entries
8 entries across 8 versions & 1 rubygems