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

Failure in Fixtures

I am repeatedly getting this error message:

1) Failure:
UserTest#test_a_user_should_have_a_unique_profile_name [test/models/user_test.rb:31]:
Failed assertion, no message given.

My user_test.rb file looks like this:

require 'test_helper'

class UserTest < ActiveSupport::TestCase
  test "a user should enter a first name" do
    user = User.new
    assert !user.save
    assert !user.errors[:first_name].empty?
  end

  test "a user should enter a last name" do
    user = User.new
    assert !user.save
    assert !user.errors[:last_name].empty?
  end

  test "a user should enter a profile name" do
    user = User.new
    assert !user.save
    assert !user.errors[:profile_name]. empty?
  end

  test "a user should have a unique profile name" do
    user = User.new
    user.profile_name = 'jason'
    user.email = "jseifer@teamtreehouse.com"
    user.first_name = "Jason"
    user.last_name = "Seifer"
    user.password = "12345678"
    user.password_confirmation = "12345678"

    assert !user.save
    assert !user.errors[:profile_name].empty?
  end
end

Please help me - I'm only a beginner :)

2 Answers

Solved it - I just needed to make sure that the user in the 'users.yml' file was the same as the user in the 'user_test.rb' file.

you just solved my problem for me. Thanks

;)