Test Confusion


Hi all,

I am getting a different test result depending if I run the test case
directly versus running via “rake test_functional”.

When running directly I get:

ruby test/functional/admin/account_controller_test.rb
Loaded suite test/functional/admin/account_controller_test

Finished in 0.25 seconds.

4 tests, 12 assertions, 0 failures, 0 errors

Yet when I use “rake test_functional”, the first error I get is this:

Finished in 0.797 seconds.

  1. Failure:
    assert_session_has' ./test/functional/admin/account_controller_test.rb:29:intest_admin_login’]:
    <:user> is not in the session <#<ActionController::TestSession:0x350ec50
    @attributes={“flash”=>{:notice=>“Login unsuccessful.”}}>>

Don’t know if this has anything to do with it, but I’m getting a lot
of these errors as well:

  1. Error:
    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.-
    unlock_mutex' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/fixtures.rb:509:inteardown’

I’m on Rail 0.14.3. Any help is greatly appreciated.



make sure your class names in
functional/admin/account_controller_test.rb and
functional/account_controller_test.rb are not the same

or for that matter, make sure none of your tests have the same class