Forum: Ruby nil object error during integration test.

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.
3832c46fac01379dfa5b14c60fac8b5c?d=identicon&s=25 Vikas Gholap (vikas)
on 2009-05-12 08:15
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.
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (candlerb)
on 2009-05-12 09:28
> 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.
This topic is locked and can not be replied to.