我有以下资源(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
当我运行规范时,我不断收到以下错误
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
提前致谢