Rails: unit test fixture_path NameError.

Last day of my Holiday :(
Trying to write a unit test for my Rails application, I constantly got the error message below:


NameError: undefined local variable or method `fixture_path' for #<LessonTest:0x9a611f8>
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/test_process.rb:452:in `method_missing'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:593:in `load_fixtures'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:538:in `setup_with_fixtures'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:575:in `setup'

Very strange: the Unit Test I've written was generated and exactly the same as shown in the example in the "Agile Web Development with Rails 2nd Edition" book.


require File.dirname(__FILE__) + '/../test_helper'
class LessonTest < Test::Unit::TestCase
def test_truth
assert true
end
end

Well I found a solution, but I still haven't found the reason WHY this is happening. You can see this is as a temporary hack.

In your: "/test/test_helper.rb" add the following method:


def fixture_path
File.dirname(__FILE__) + "/fixtures/"
end