Testing webservices in Integration Tests with Jamis Buck's r

Hello,

I’m using Jamis B.'s recipe to do integration tests on an
application, but I got a nil.recycle! error while doing a webservice
call.

This is the situation.

def test_uploading_data
invoke :upload, data
invoke :upload, even_more_data

real_user_session = new_session_as @real_user
real_user_session.press_magic_button_to_enable_more_uploads

invoke :upload, super_new_data
end

Test test results in a nil.recycle! error message on the last invoke:

NoMethodError: You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.recycle!
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.2.1/lib/
action_web_service/test_invoke.rb:32:in prepare_request' /usr/lib/ruby/gems/1.8/gems/actionwebservice-1.2.1/lib/ action_web_service/test_invoke.rb:9:ininvoke’

It seems that the default @request in the setup is corrupted by our
open_session implementation?
Can somebody help me on this?

Best regards,
Jeroen Knoops

Hi Jeroen,

I was having exactly this error in my functional tests. I added the
following method to my test class:

def setup
@controller = MyController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end

…and everything went through fine. Hope that helps!

  • Eric Budd

[email protected] wrote:

Hello,

I’m using Jamis B.'s recipe to do integration tests on an
application, but I got a nil.recycle! error while doing a webservice
call.

This is the situation.

def test_uploading_data
invoke :upload, data
invoke :upload, even_more_data

real_user_session = new_session_as @real_user
real_user_session.press_magic_button_to_enable_more_uploads

invoke :upload, super_new_data
end

Test test results in a nil.recycle! error message on the last invoke:

NoMethodError: You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.recycle!
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.2.1/lib/
action_web_service/test_invoke.rb:32:in prepare_request' /usr/lib/ruby/gems/1.8/gems/actionwebservice-1.2.1/lib/ action_web_service/test_invoke.rb:9:ininvoke’

It seems that the default @request in the setup is corrupted by our
open_session implementation?
Can somebody help me on this?

Best regards,
Jeroen Knoops