I am working on writing simple unit tests for a Rails 3 project, but I cannot run any tests.
The fact is that an attempt to automatically run the Rails test with an error fails:
require 'test_helper' class UserTest < ActiveSupport::TestCase
Results with the following error:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- test_helper (LoadError) from <internal:lib/rubygems/custom_require>:29:in `require' from user_test.rb:1:in `<main>'
Commenting out the required line test_helper and trying to run the test results with this error:
user_test.rb:3:in `<main>': uninitialized constant Object::ActiveSupport (NameError)
The gems from the action pack must be correctly installed and updated:
actionmailer (3.0.3, 2.3.5) actionpack (3.0.3, 2.3.5) activemodel (3.0.3) activerecord (3.0.3, 2.3.5) activeresource (3.0.3, 2.3.5) activesupport (3.0.3, 2.3.5)
Ruby is at 1.9.2p0 and Rails is at 3.0.3.
An example dump of my test directory is as follows:
/fixtures /functional /integration /performance /unit
I have never seen this problem before - I run typical rake tasks to prepare a test environment. I have nothing unusual in my application or environment configuration files, and I have not installed any unusual stones that would interfere with the test environment.
Change March 9
Xavier Holt clause explicitly indicating the path to test_helper; however, this revealed a problem with ActiveSupport.
Now, when I try to run the test, I get the following error message (also the above):
user_test.rb:3:in `<main>': uninitialized constant Object::ActiveSupport (NameError)
But, as you can see above, the Action Pack is installed and updated to date.
Edit March 13th
When trying to run tests using rake test:units , the following stack trace is reset to the console:
test/unit/bookmark_test.rb:3:in `<top (required)>': uninitialized constant Objec t::ActiveSupport (NameError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `block in <main>' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `<main>' rake aborted!
So, looking at the file above, I see the following:
#!/usr/bin/env ruby
As far as I know, everything looks as expected.