Ruby on rails HTTP请求';删除';在轨道测试中
我正在跟踪关于身份验证的操作,但遇到了一个错误。在清单8.28中,我们向集成测试中添加了测试注销用户的代码。这涉及发送“删除”HTTP请求。运行此测试后,结果应为绿色,但我遇到以下错误: 错误[“使用有效信息测试\u登录\u,然后再测试\u注销”, UsersLoginTest,2015-04-15 03:20:30+0000] 使用有效信息测试登录,然后退出用户登录测试 (1429068030.89s)AbstractController::ActionNotFound:Ruby on rails HTTP请求';删除';在轨道测试中,ruby-on-rails,ruby,ruby-on-rails-4,Ruby On Rails,Ruby,Ruby On Rails 4,我正在跟踪关于身份验证的操作,但遇到了一个错误。在清单8.28中,我们向集成测试中添加了测试注销用户的代码。这涉及发送“删除”HTTP请求。运行此测试后,结果应为绿色,但我遇到以下错误: 错误[“使用有效信息测试\u登录\u,然后再测试\u注销”, UsersLoginTest,2015-04-15 03:20:30+0000] 使用有效信息测试登录,然后退出用户登录测试 (1429068030.89s)AbstractController::ActionNotFound: AbstractCo
AbstractController::ActionNotFound:无法删除操作 为SessionController找到 test/integration/users\u login\u test.rb:28:in
block in'
测试/集成/用户\u登录\u测试.rb:28:in
block in'
我在这个问题上找不到任何东西。有人知道这是什么原因吗?作为记录,我正在使用MichaelHartl在教程中推荐的Cloud9IDE
按要求发送文件:
Rails.application.routes.draw do
root 'static_pages#home'
get 'help' => 'static_pages#help'
get 'about' => 'static_pages#about'
get 'contact' => 'static_pages#contact'
get 'signup' => 'users#new'
get 'login' => 'sessions#new'
post 'login' => 'sessions#create'
delete 'logout' =>'sessions#delete'
resources :users
end
路线:
delete 'logout' =>'sessions#delete'
应该是:
delete 'logout' =>'sessions#destroy'
请把你的路线文件贴出来谢谢,那确实是错误的地方!