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

Programming -> Build a Simple Ruby on Rails Application -> Writing Tests -> Fixtures

This is how my user_test.rb and users.yml tabs look like. At least the parts that are relevant for this problem.

user_test.rb

test "A user should have a unique profile name" do user = User.new user.profile_name = users(:Edgar).profile_name assert !user.save assert !user.errors[:profile_name].empty? end

users.yml

Edgar: first_name: "Edgar" last_name: "Gutierrez" email: "edgar.gutierrez.gzz@gmail.com" profile_name: "EdgarGtz"

And here is the error message I'm getting. I would appreciate any help I can get.

Rack::File headers parameter replaces cache_control after Rack 1.5. Run options:

Running tests:

...E

Finished tests in 0.135379s, 29.5467 tests/s, 44.3200 assertions/s.

1) Error: test_A_user_should_have_a_unique_profile_name(UserTest): StandardError: No fixture with name 'edgar' found for table 'users' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/fixtures.rb:805:in block (4 levels) in setup_fixture_accessors' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/fixtures.rb:797:inmap' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/fixtures.rb:797:in block (3 levels) in setup_fixture_accessors' test/unit/user_test.rb:24:inblock in <class:UserTest>'

4 tests, 6 assertions, 0 failures, 1 errors, 0 skips

2 Answers

Looks like it might be that you capitalized the first fixture name "Edgar:" in users.yml and it's looking for lowercase:

No fixture with name 'edgar'

I just tried it and it worked! Thanks a lot Steve!