class UserStoriesTest < ActionController::IntegrationTest
test "some test" do
get "/"
assert_response :success
get "/"
assert_response :success
end
end
When I run the code above the first assertion passes. However, the
second assertion fails because the response is a 500. To be more
specific I get this error:
Expected response to be a <:success>, but was <500>
<"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.+">
Anyone have an explanation? I want to to test some going to the
homepage and then clicking on a link to the login page which is why I
am calling consecutive GET requests. Help me if I am going about it
the wrong way.
Well this is all I get and i can't really make anything out of it:
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.+):
/test/integration/user_stories_test.rb:12:in `some_test'
Which is that line? The code you showed only had 8 lines.
It's line #6. Sorry I cut out some comments and stuff so as to not
clutter the post. The response is a 500 and the assertion is failing
on like number 6 because it is expecting a 200. I'm just trying to
figure out why it's a 500.
Well this is all I get and i can't really make anything out of it:
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.+):
/test/integration/user_stories_test.rb:12:in `some_test'
You'd need to at least look at what's on that line and see what's on the left side of a '+'. THAT object is probably nil (and the whiny nils of Rails is looking for something that responds to + and offers Array as one possibility).
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
It's line #6. Sorry I cut out some comments and stuff so as to not
clutter the post. The response is a 500 and the assertion is failing
on like number 6 because it is expecting a 200. I'm just trying to
figure out why it's a 500.
The error in the trace is showing as line 12, are you saying that is
the assert line? Could you post the whole file please just to keep me
happy.
Could you post the log showing the first half of the test also (the
get that works).
Please don't top post, it makes it difficult to follow the thread. Thanks.
I'm not sure what you mean by "see what's on
the left side of a '+'." because there is no '+'.
Just out of curiosity, can someone run this test on their app? I've
found that the same error happens even on a simple app that has a root
url available.
I'm not sure what you mean by "see what's on
the left side of a '+'." because there is no '+'.
Just out of curiosity, can someone run this test on their app? I've
found that the same error happens even on a simple app that has a root
url available.
So I investigated further and it seems to be a facebooker problem with
session management. When I find the root problem, I'll post what it is
and what I did to fix it. Thanks for the help!