我有以下资源(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
提前致谢
答案 0 :(得分:0)
对不起有困惑