我遇到了一个失败的测试,我很难调试。路由测试失败: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