2013-05-31 133 views
0

我有這樣的路線:put_via_redirect Rails中集成測試

put "https://stackoverflow.com/users/:id/activate?:verification_key" => "users#activate", :as => 'verification' 

我想在集成測試訪問此航線

put_via_redirect verification_path, :id => 1, :verification_key => 1234 

耙試驗得出:

No route matches {:action=>"activate", :controller=>"users"} missing required keys: [:id, :verification_key] 

是什麼這是正確的語法?謝謝。

回答

0

我發現它更容易改變參數語法,並使用斜槓代替。

get "https://stackoverflow.com/users/:id/:verification_key" => "users#activate", :as => 'verification' 

從用戶郵件模板,我訪問該鏈接是這樣的:

<a href="<%[email protected]%><%=url_for verification_path(:host => @host, :id=>@user.id, :verification_key=>@key) %>">Activate</a>