# Incompatibility in behaviour of "rake test" and "ruby -Itest

**URL:** <https://www.ruby-forum.com/t/incompatibility-in-behaviour-of-rake-test-and-ruby-itest/156323>\
**Category:** Rails\
**Created:** [December 24, 2008, 2:30pm UTC](https://www.ruby-forum.com/t/incompatibility-in-behaviour-of-rake-test-and-ruby-itest/156323 "2008-12-24T14:30:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![evgeny-cd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e19b73/32.png) [@evgeny-cd](https://www.ruby-forum.com/u/evgeny-cd)\
**Post date:** [December 24, 2008, 2:30pm UTC](https://www.ruby-forum.com/t/incompatibility-in-behaviour-of-rake-test-and-ruby-itest/156323/1 "2008-12-24T14:30:31Z")

</div>

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  
test:integration”.  
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, Evgeny

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 end end assert actor.chats.eql?(chats) end end

$ruby -Itest test/integration/actor\_chat\_spaces\_test.rb  
Loaded suite test/integration/actor\_chat\_spaces\_test  
Started  
…  
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  
“/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake\_test\_loader.rb”  
“test/integration/actor\_chat\_spaces\_test.rb”  
“test/integration/space\_chat\_model\_test.rb”  
Loaded suite  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake\_test\_loader  
Started  
E…  
Finished in 0.183948 seconds.

1. Error:  
test\_actor\_chats(ActorChatSpacesTest):  
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  
./test/integration/actor\_chat\_spaces\_test.rb:15:in  
`test_actor_chats' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/testing/setup_and_teardown.rb:67:in` **send** ’  
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active\_support/testing/setup\_and\_teardown.rb:67:in  
`run' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/integration.rb:600:in`run’

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

(See full trace by running task with --trace)
