我有以下资源(config/routes.rb)
resources :dashboard
dashboard_index GET /dashboard(.:format) dashboard#index
POST /dashboard(.:format) dashboard#create
new_dashboard GET /dashboard/new(.:format) dashboard#new
edit_dashboard GET /dashboard/:id/edit(.:format) dashboard#edit
dashboard GET /dashboard/:id(.:format) dashboard#show
PUT /dashboard/:id(.:format) dashboard#update
DELETE /dashboard/:id(.:format) dashboard#destroy并且我有以下控制器规范
require 'spec_helper'
describe DashboardController do
describe "GET 'index'" do
it "returns http success" do
get :index
response.should be_success
end
end
end当我运行spec时,我一直收到以下错误
Failures:
1) DashboardController GET 'index' returns http success
Failure/Error: get :index
ActionController::RoutingError:
No route matches {:controller=>"dashboard"}
# ./spec/controllers/dashboard_controller_spec.rb:7:in `block (3 levels) in <top (required)>'
Finished in 0.12126 seconds当我检查类似的问题时,几乎所有的问题都是因为没有传递必需的参数,但在我的例子中,我的操作不需要参数,那么这里缺少的部分是什么
我上线了
gem 'rails', '3.2.9'
group :test, :development do
gem "rspec-rails", "~> 2.0"
end提前感谢
发布于 2012-12-18 06:09:03
正如@John Naegle指出的那样,这似乎是我的spork +卫士设置的问题,并且它没有拿起'routes.rb‘文件
很抱歉给您带来了混乱
https://stackoverflow.com/questions/13922704
复制相似问题