0
我有以下資源(CONFIG/routes.rb中)rspec2路由錯誤索引頁[Rails3中,Rspec2]
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
在此先感謝
你運行叉勺或混淆的問題還有什麼可能不會改變routes.rb? –
@JohnNaegle,是的,你是對的,我的壞;(我使用spork +後衛,似乎它沒有拿起routes.rb。非常感謝答案 – sameera207
在那裏,做到了;) –