Ruby on Rails testing: How can I test or at the very least see a form_for's error_messages_for?

You can access the validation errors on an object using model. Errors Use model.errors. On(:field_name) to get an array of error messages applied to a particular field.

You can also use model.errors. Invalid?(:field_name) in your tests to assert that an error was triggered for a particular field For example: test "should reject invalid post" do @p = Post. New assert!

@p. Valid? Assert_equal @p.errors.

On(:title), 'cannot be blank' end.

You can access the validation errors on an object using @model.errors. Use @model.errors. On(:field_name) to get an array of error messages applied to a particular field.

You can also use @model.errors. Invalid?(:field_name) in your tests to assert that an error was triggered for a particular field. For example: test "should reject invalid post" do @p = Post.

New assert! @p. Valid?

Assert_equal @p.errors. On(:title), 'cannot be blank' end.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions