Forum: Ruby on Rails Test Confusion

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E37ca8b3eee534fa6781f7ba13743afb?d=identicon&s=25 ryan.wood (Guest)
on 2005-11-27 19:37
(Received via mailing list)
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
Started
....
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:

Started
FEFEFEEFEEE...................
Finished in 0.797 seconds.

  1) Failure:
test_admin_login(AccountControllerTest)
    [c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/deprecated_assertions.rb:23:in
`assert_session_has'
     ./test/functional/admin/account_controller_test.rb:29:in
`test_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:

  2) Error:
test_admin_login(AccountControllerTest):
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.-
    c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:112:in
`unlock_mutex'
    c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/fixtures.rb:509:in
`teardown'

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

--Ryan
A78fabe22aa7df17f05cb02e622e20a7?d=identicon&s=25 jerrett (Guest)
on 2005-11-28 18:31
(Received via mailing list)
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
names
This topic is locked and can not be replied to.