Rails tests can't find test_helper
ruby 1.9.2 removed ".", the current directory, from the load path. I have to do this to get it to work:
require 'test_helper'
and call it like:
ruby -I. unit/person_test.rb
I was fighting this thing myself today and i dislike the big require with whole path to file and stuff...
In my case it was fault of Rakefile..
so now it looks like this:
require "bundler/gem_tasks"require "rake/testtask"Rake::TestTask.new do |t| t.libs << "lib" t.libs << "test" # here is the test_helper t.pattern = "test/**/*_test.rb"endtask default: :test
I know its old and has answer marked accepted, but maybe this will also help someone :)have a nice day
I've added the following to the top of my test files.
require File.expand_path("../../test_helper", __FILE__)
This restores the previous behavior and allows the call to be simply:
ruby test/unit/person_test.rb