Hello.
I hope this is the right place to describe my problem â?¦
After upgrading to Rails version 1.1.2 from rails version 1.0.0, Web
Service functional tests seem broken.
I upgraded rails (as the root user / administrator) with:
gem update rails --include-dependencies
then I upgraded my application (as myself) with:
½ rake rails:update
% rake rails:update:configs
After these steps, working before Web Services functional tests broke.
To try to isolate the problem, I scaffolded a simple Web Services
Controller:
% ./script/generate web_service Problem my_method
Running the test on this Controller, I get:
% ruby test/functional/problem_api_test.rb
Loaded suite test/functional/problem_api_test
Started
E
Finished in 0.047129 seconds.
- Error:
test_my_method(ProblemControllerApiTest):
NoMethodError: You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.length
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/test_invoke.rb:55:in
encode_rpc_call' /usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/test_invoke.rb:36:in
prepare_request’
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/test_invoke.rb:9:in
invoke' test/functional/problem_api_test.rb:14:in
test_my_method’
1 tests, 0 assertions, 0 failures, 1 errors
The freshly scaffolded files are:
* app/apis/problem_api.rb
class ProblemApi < ActionWebService::API::Base
api_method :my_method
end
* app/controllers/problem_controller.rb
class ProblemController < ApplicationController
wsdl_service_name 'Problem'
def my_method
end
end
* test/functional/problem_api_test.rb
require File.dirname(__FILE__) + '/../test_helper'
require 'problem_controller'
class ProblemController; def rescue_action(e) raise e end; end
class ProblemControllerApiTest < Test::Unit::TestCase
def setup
@controller = ProblemController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_my_method
result = invoke :my_method
assert_equal nil, result
end
end
On my real application, Web Services working before tests return many
more errors, like:
% ruby test/functional/web_svc/backend_api_test.rb
Loaded suite test/functional/web_svc/backend_api_test
Started
E…FF…E
Finished in 0.557281 seconds.
-
Error:
test_find_all_softwares(WebSvc::BackendControllerApiTest):
NoMethodError: You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.length
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/test_invoke.rb:55:in
encode_rpc_call' /usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/test_invoke.rb:36:in
prepare_request’
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/test_invoke.rb:9:in
invoke' test/functional/web_svc/backend_api_test.rb:90:in
test_find_all_softwares’ -
Failure:
test_new_bad_category(WebSvc::BackendControllerApiTest)
[test/functional/web_svc/backend_api_test.rb:33]:
exception expected but none was thrown.
I am using Ruby version ruby 1.8.4 (2005-12-24) [i386-linux].
So where is the problem? What am I doing wrong?
Thank you very much for your help!