2014-04-22 3 views
8

Rails 3.2.x에서 Rails 4.0.4로 응용 프로그램을 이식하려고합니다. 모든 보석은 호환이 가능하며 실패한 테스트를 수정하는 단계에 있습니다.레일 4 업그레이드 - ActionController :: UrlGenerationError - 경로 일치 없음

나는 이상한 시험 실패를 경험했다.

routes.rb

resources :my_reports, only: [:index] do 
    collection do 
    get "/report/:filename", to: :show, prefix: "pri/excl/rep", as: :show 
    end 
end 
가 레일 3.2.x에 전달하고 지금은 다음과 같은 오류

무엇입니까 4.0.4

describe MyReportsController do 
    describe "#show" do 
    def make_request 
     get :show, prefix: 'some/place', filename: 'foo', format: 'doc' 
    end 

    it "makes a simple request" do 
     make_request 
    end 
    end 
end 

로 업데이트 후 실패했습니다

내 사양

Failure/Error: get :show, prefix: 'some/place', filename: 'foo', format: 'doc' 
    ActionController::UrlGenerationError: 
     No route matches {:action=>"show", :controller=>"my_reports", 
     :filename=>"foo", :format=>"doc", :prefix=>"some/place"} 

나는이 시점에서 갇혀 있는데, 힌트를 환영합니다. rspec 및 rspec-rails 버전 2.14.1을 사용하고 있습니다.

답변

13

더미에 패스 : 테스트에서 id는 나를 위해 문제를 해결했지만 마음에 들지 않지만 테스트는 통과합니다.

get :show, id: "", prefix: 'some/place', filename: 'foo', format: 'doc' 

레일 릴리스 상태 here을 참조하십시오.

0

show 방법을 설명하고 있지만 귀하의 경로는 index에만 있습니다. 어쩌면 그것은 해결책의 시작일 것입니다.

+0

아니요, 이미 확인했습니다. 리소스에 쇼를 포함 시켰지 만 명시 적으로': as '를 사용했을 때 아무런 영향을주지 않아야합니다 – bragboy

+0

중첩 된 메소드없이'get : show, prefix : ...'를 직접 시도 했습니까? – BriceB