I setup a testing model in my Depot web app from the Agile Web Development with Rails book and came up with the following errors: Loaded suite test/unit/product_test Started EE Finished in 0.050279 seconds. 1) Error: test_create(ProductTest): Errno::ENOENT: No such file or directory - /Users/Mike/Sites/depot/config/../test/fixtures/categories /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:327:in `open' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:327:in `read_fixture_files' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:279:in `initialize' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:251:in `create_fixtures' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:250:in `create_fixtures' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:794:in `silence' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:248:in `create_fixtures' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:565:in `load_fixtures' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:512:in `setup_with_fixtures' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:547:in `setup' 2) Error: test_create(ProductTest): NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occured while evaluating nil.- /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/transactions.rb:112:in `unlock_mutex' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:534:in `teardown' 1 tests, 0 assertions, 0 failures, 2 errors ----- I had already created all relevant text fixtures and had already modiefied my product_test.rb file prior to running this for my test database.
on 2006-04-13 05:25
on 2006-05-05 14:13
im not sure if this will solve your problem but i almost had the same error. im also learning and following the book. make sure you dont use or insert tabs in products.yml . all the while i thought i use spaces instead of tabs. for example: programmer_book: id: 1 title: Pragmatic Programmer description: Best book for the programmer image_url: http://localhost:3000/images/pp.jpg price: 29.95 date_available: 2006-05-01 00:00:00 ^^ ^^^^ in this example, all the spaces (indicated with ^) should be a space and not tab. i kept on getting errors and i was thinking maybe because i was using rails 1.1.2 so i reverted back to 1.0. still there were errors. the culprit was, i didnt know i was using tabs on the start of the line (before the key). and i thought space should be used only in between the key and value. after that, my test was successful and solved the ENOENT error. hth