레일즈 2.3.18에서 3.2.x로 업그레이드 중이며 컨트롤러 테스트에서이 한 세트의 문제가 발생했습니다 :정의되지 않은 메소드 relative_url_root for nil : 네임 스페이스 컨트롤러에서 rspec을 실행할 때 NilClass
오류 :
/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
경로 :
012 내 컨트롤러에 대한 특별 36,아무것도 :
class Integrations::FormstackController < ApplicationController
def oauth_token
...
end
end
그래서 약
get "any_action_in_this_controller"
는이 relative_url_root 오류가 발생 무엇입니까? 이 컨트롤러의 모든 작업에 대한 모든 테스트에서 오류가 발생합니다.
내가 디버깅하는 데 도움이되는 다른 정보를 알려주십시오.
당신이있는 경우, @marcario에서 언급 한 바와 같이
여기에서와 같이 작동시킬 수 있습니까? 내 컨트롤러도 네임 스페이스입니다 ... – Macario
컨트롤러는 config라는 작업을 할 수 없으며 문제의 이름을 바꿔서 문제를 해결했습니다 – Macario