Forum: Ruby on Rails Incompatibility in behaviour of "rake test" and "ruby -Itest

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Evgeny B. (Guest)
on 2008-12-24 15:30
Hello everybody,

I had a following problem today. My test that I used to run successfully
with "ruby -Itest" is failing when it is run with "rake
I can't understand why.

Could you please check below the test class definition and output that
"ruby -Itest" and "rake test:integration" give me.

Thank you in advance,
class ActorChatSpacesTest < ActionController::IntegrationTest
  fixtures :actors, :spaces, :invitations, :roles

  def test_actor_chats
    actor = actors(:Christophe)
    chats = []
    chat_spaces = Space.get_chat_spaces()
    chat_spaces.each do |chat_space|
      if chat_space.actors.include?(actor)
        chats = chats << chat_space
    assert actor.chats.eql?(chats)
$ruby -Itest test/integration/actor_chat_spaces_test.rb
Loaded suite test/integration/actor_chat_spaces_test
Finished in 0.160407 seconds.

2 tests, 2 assertions, 0 failures, 0 errors
$ rake test:integration
(in /Users/assistants/workspace/elogbook/trunk)
/opt/local/bin/ruby -Ilib:test
Loaded suite
Finished in 0.183948 seconds.

  1) Error:
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each

6 tests, 13 assertions, 0 failures, 1 errors
rake aborted!
Command failed with status (1): [/opt/local/bin/ruby -Ilib:test

(See full trace by running task with --trace)
This topic is locked and can not be replied to.