# Nil object error during integration test

**URL:** <https://www.ruby-forum.com/t/nil-object-error-during-integration-test/167749>\
**Category:** Ruby\
**Created:** [May 12, 2009, 8:15am UTC](https://www.ruby-forum.com/t/nil-object-error-during-integration-test/167749 "2009-05-12T08:15:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ac91a4/32.png) [@vikas](https://www.ruby-forum.com/u/vikas)\
**Post date:** [May 12, 2009, 8:15am UTC](https://www.ruby-forum.com/t/nil-object-error-during-integration-test/167749/1 "2009-05-12T08:15:10Z")

</div>

hello all,

I have a simple test case that load home page.  
When I run test i got following error.

test\_load\_site\_with\_out\_errors(UserScenariosTest)  
[test/integration/user\_scenarios\_test.rb:18:in `get_home_page' test/integration/user_scenarios_test.rb:7:in`test\_load\_site\_with\_out\_error  
s’  
F:/Aflatune\_Community\_Engine/aflatune/vendor/rails/activesupport/lib/active  
\_support/testing/setup\_and\_teardown.rb:60:in ` __send__' F:/Aflatune_Community_Engine/aflatune/vendor/rails/activesupport/lib/active _support/testing/setup_and_teardown.rb:60:in`run’  
F:/Aflatune\_Community\_Engine/aflatune/vendor/rails/actionpack/lib/action\_co  
ntroller/integration.rb:597:in `run’]:  
Expected response to be a \<:success\>, but was \<500\>  
\<“You have a nil object when you didn’t expect it!\nThe error occurred  
while eva  
luating nil.downcase”\>

2 tests, 1 assertions, 1 failures, 0 errors

* * *

user\_scenarios\_test.rb

require “#{File.dirname( **FILE** )}/…/test\_helper”  
class UserScenariosTest \< ActionController::IntegrationTest  
fixtures :users

# Load home page with out error

def test\_load\_site\_with\_out\_errors  
get\_home\_page  
end

private  
def get\_home\_page  
get “/home/index”  
assert\_response :success  
assert\_template “index”  
end

## end

can anyone tell me about this error and solution.

Thanks,  
Vikas.

---

<div class="post-metadata">

**Author:** ![vikas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ac91a4/32.png) [@vikas](https://www.ruby-forum.com/u/vikas)\
**Post date:** [May 12, 2009, 9:28am UTC](https://www.ruby-forum.com/t/nil-object-error-during-integration-test/167749/2 "2009-05-12T09:28:07Z")

</div>

> can anyone tell me about this error and solution.

It seems that somewhere in your code you are doing something.downcase,  
and at that point something is nil:

> \<“You have a nil object when you didn’t expect it!\nThe error occurred  
> while evaluating nil.downcase”\>

However, Rails questions are best directed to a Rails forum or mailing  
list.

Regards,

Brian.
