我正在进行从 Rails 2.3.18 升级到 3.2.x 的工作,但我遇到了一组控制器测试的问题:
错误:
/actionpack-3.2.12/lib/action_controller/test_case.rb:514:in `build_request_uri'
/actionpack-3.2.12/lib/action_controller/test_case.rb:470:in `process'
/actionpack-3.2.12/lib/action_controller/test_case.rb:49:in `process'
/actionpack-3.2.12/lib/action_controller/test_case.rb:390:in `get'
# ./spec/controllers/integrations/formstack_controller_spec.rb:104:in `block (3 levels) in <top (required)>'
代码触发错误:
it "should handle a failed access_token retreival" do
FormStack::Oauth2Connection.any_instance.stub(:identify).and_return(nil)
get "oauth_token" # this line <---------------------------------------------------------------- 104
response.should redirect_to(:controller => "/integrations/", :action => :index)
flash[:error].should include("error")
end
此控制器的路线:
namespace :integrations, path: "/integrations" do
match "formstack/oauth_token", :to => "formstack#oauth_token"
resources :formstack
end
我的控制器没什么特别的:
class Integrations::FormstackController < ApplicationController
def oauth_token
...
end
end
那是怎么回事
get "any_action_in_this_controller"
导致这个 relative_url_root 错误?此控制器的每个操作的每个测试都会引发错误。
我还能提供哪些其他信息来帮助你们帮助我调试这个?