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
actor = actors(:Christophe)
chats = 
chat_spaces = Space.get_chat_spaces()
chat_spaces.each do |chat_space|
chats = chats << chat_space
$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
Finished in 0.183948 seconds.
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
Command failed with status (1): [/opt/local/bin/ruby -Ilib:test
(See full trace by running task with --trace)