Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Simple Ruby on Rails Application Writing Tests Validating Format

Why do error messages not display?

At 1:13 in this video Jason Seifer explicitly states that we're adding an another assertion to display an error message. When he runs the test at 1:40 the screen displays "Failed assertion, no message given"

Why did we write that extra assertion that "must be formatted correctly" if it is not displayed? How we correctly display a message for failed assertions?

1 Answer

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Scott Lundgren by default the assert statement doesn't return a message. You can specify one by adding a comma and the message you'd like to see.

assert user.errors[:profile_name].include?("Must be formatted correctly."), "Invalid profile name format"