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
Dee Barizo
8,402 PointsTesting the Profile Name - password needs eight or more characters to pass the test
For Testing the Profile Name, I couldn't get the test at 3:20 to pass unless I put a password with 8 or more characters in the test.
test "a user can have a correctly formatted profile name" do
user = User.new(first_name: 'Dee', last_name: 'Barizo', email: 'deebarizo2@gmail.com')
user.password = user.password_confirmation = 'adfdadfd'
user.profile_name = 'deebarizo_1'
assert user.valid?
end
See where it says 'adfdadfd', the string between the single quotes should be at least 8 characters.
5 Answers
Allan Evans
9,501 PointsThat's weird, tried that out but still getting the initial failure in the first half of the video where 'no message given', let me know if you see something missing, or if there is something different needed for windows. I've had this problem since the first group of tests:
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :profile_name validates :first_name, presence: true validates :last_name, presence: true validates :profile_name, presence: true, uniqueness: true, format: { with: /^[a-zA-Z0-9_-]+$/, message: 'Must be formatted properly.' }
has_many :statuses
def full_name first_name + " " + last_name end end
Dee Barizo
8,402 PointsTry
/^[a-zA-Z0-9_-]+$/
instead of
/^[a-zA-Z0-9-]+$/
The code you have doesn't have the underscore.
Allan Evans
9,501 PointsWeird it's that way in the user.rb file, I'll try it out again and see if I get the same message.
Allan Evans
9,501 PointsI get the assertion failure in the video (testing profile name) but the solution doesn't seem to fix it. Hmm, I'll keep digging, see if I can find it.
Dee Barizo
8,402 PointsTry emailing Treehouse at help@teamtreehouse.com.
Good luck!