Rspec没有路线匹配
我在rspec中遇到以下错误:
1) LandingController landing#index returns http success Failure/Error: get :index ActionController::RoutingError: No route matches {:controller=>"landing"} # ./spec/controllers/landing_controller_spec.rb:7:in `block (3 levels) in '
这是考验
require 'spec_helper' describe LandingController do describe "landing#index" do it "returns http success" do get :index response.should be_success end end end
我以root :to => 'landing#index'
。 所有其他测试都在通过,只有这一个失败,有人可以帮助我理解为什么吗?
为了完整性,这是rake routes
的输出
root / landing#index auth_google_oauth2_callback /auth/google_oauth2/callback(.:format) sessions#create signout /signout(.:format) sessions#destroy dashboard /dashboard(.:format) dashboard#index
如果您正在使用Spork,则可能需要在更新路由时重新启动服务器。
你是否尝试使用get '/'
访问根页面? 应该管用。