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
Bharat Chatla
704 PointsTreebook (Ruby on Rails) Writing Tests Error - a user should have unique profile name
Get an error while executing the following test
test "a user should have unique profile name" do user = User.new user.profile_name = "test1" user.email = "test@gmail.com" user.first_name = "firstname" user.last_name = "lastname" assert !user.save puts user.errors.inspect assert !user.errors[:profile_name].empty? end
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message. ...#<ActiveModel::Errors:0x007fe665a09788 @base=#<User id: nil, first_name: "firstname", last_name: "lastname", profile_name: "test1", email: "test@gmail.com", encrypted_password: "", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: nil, updated_at: nil>, @messages={:password=>["can't be blank"]}> F
Finished tests in 0.056717s, 70.5256 tests/s, 141.0512 assertions/s.
1) Failure: UserTest#test_a_user_should_unique_profile_name [test/models/user_test.rb:33]: Failed assertion, no message given.
4 tests, 8 assertions, 1 failures, 0 errors, 0 skips