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 trialjoel bindi
11,923 PointsBuilding the profile page, challenge 1
Stuck on this code. http://teamtreehouse.com/library/build-a-simple-ruby-on-rails-application/building-the-profile-page/testing-the-profile-name
not sure where I'm going wrong ? any help appreciated...
validates :profile_name, presence: true, uniqueness: true, format: { with: /^[a-zA-Z0-9_-]+$/, message: 'Must be formatted correctly.' }
1 Answer
Maciej Czuchnowski
36,441 Points"validates" is not a keyword used in test files. It's something you put in a model and these tasks you are linking are only concerned with the tests (user_test.rb). In the first task you just set the user.profile_name to something proper, like 'johnny', and in the second task you are just asked to use "assert" to check if that name is valid. Look at the videos again and see where and how Jason uses the "assert" keyword.
I think it is assumed that there is a proper validation in the model already, you just need a proper test.