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 Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Editing Todo Items

Gabriele Rossi
Gabriele Rossi
5,887 Points

How does have_content work?

I hope this is not a silly question but I don't really understand how the have_content method works. What I mean by that is that I don't really know how Jason knows what to expect as output. This might sound obvious but I don't think it is ever explained in the tutorial.

For example, is "Content is too short" the standard message for when content is too short? Does the same work for "Content can't be blank"? What I don't get is id these statements are defined by Capybara and we need to know them to test against them or if they are somehow defined elsewhere.

1 Answer

Brandon Keene
Brandon Keene
7,217 Points

You're not wrong, there's great deal in that course that feels sort of "glossed over." I got the impression that there are definitely times when methods are being used that Jason doesn't write, but which are generated by rails.

However, to the latter half of your question, my experience generally was "if it's in quote marks, it's a ruby string" and if it's a ruby string, you can play around with it. For example, I decided that "Are you sure you want to delete this note" was too formal, so I had mine just output "Seriously?"

Play around with it, and see if it breaks!

Gabriele Rossi
Gabriele Rossi
5,887 Points

Thank you Brandon, it's good to hear that I'm not the only one feeling that way. I shall try and poke the code and see what happens. Thank you :-)

Brandon Keene
Brandon Keene
7,217 Points

Happy to help! And remember: if something goes truly awry, you'll finally get to feel like all those git commits were worth it!