Hi! I have this test: def test_invalid_date_format project = Project.new(:name => "Terminar página web", :user_id => "1", :deadline => "fsafasdfa") assert !project.valid? assert_equal "Deadline has invalid syntax", project.errors.on(:deadline) end and I have this validation in the model: protected def validate if deadline.nil? return true else begin dt = DateTime.parse(deadline.to_s) rescue ArgumentError errors.add(:deadline, "Deadline has invalid syntax") end end end When I execute this test I have this: 1) Failure: test_invalid_date_format(ProjectTest) [project_test.rb:47:in `test_invalid_date_format'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/testing/default.rb:7:in `run'']: <false> is not true. How is this possible? Do not Datetime.parse returns false when it is not a correct datetime string? How do you validate and test DateTime fields? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---