Assertions and Code Structure

Learn about some of the common assertions used in MiniTest and Rails and familiarize yourself with the Rails testing code structure.

We'll cover the following

Assertions

An assertion is simply a line of code that checks and evaluates an expression or object for an expected result. You can use assertions to check things like:

  • Does value1= value2?
  • Does object = nil?
  • Is expression true?
  • Is the user redirected to the intended page after performing a certain action such as submitting a form?

Get hands-on with 1200+ tech skills courses.