我遇到了一個失敗的測試,我很難調試。路由測試失敗:NoMethodError:「/ the/route」的未定義方法`值':字符串
我的測試情況是:
it "routes to #active" do
get ("/parties/active").should route_to("parties#active")
end
我的路線是:
resources :parties do
get 'active', :on => :collection
end
當我運行測試時,我得到以下錯誤:
NoMethodError: undefined method `values' for "/parties/active":String
完整的錯誤輸出at:https://gist.github.com/1748264
當我運行耙路線,我看到:
active_parties GET /parties/active(.:format) parties#active
parties GET /parties(.:format) parties#index
POST /parties(.:format) parties#create
new_party GET /parties/new(.:format) parties#new
edit_party GET /parties/:id/edit(.:format) parties#edit
party GET /parties/:id(.:format) parties#show
PUT /parties/:id(.:format) parties#update
DELETE /parties/:id(.:format) parties#destroy
root / parties#show
我運行該測試是幾乎相同的測試腳手架產生新:
it "routes to #new" do
get("/parties/new").should route_to("parties#new")
end
任何想法是怎麼回事?
我正在使用Rails 3.2.1。 – 2012-02-06 08:15:41
我還發現在'before'塊中使用'get'會導致同樣的錯誤。 – 2014-09-30 03:02:01