Ruby on rails 当route'match'语句列出子目录(或嵌套路由)时,RSpec似乎中断
此处确实存在特定的controllerroute,但目录/嵌套路由“admin/”似乎会导致故障。即使路由不存在,考虑到指定的路由“calendarsindex”不存在,它也应该以与下一个路由相同的方式失败。结果路由的存在并不重要,因为这只是为了测试映射是否有效。你知道怎么解决这个问题吗Ruby on rails 当route'match'语句列出子目录(或嵌套路由)时,RSpec似乎中断,ruby-on-rails,rspec,rspec2,Ruby On Rails,Rspec,Rspec2,此处确实存在特定的controllerroute,但目录/嵌套路由“admin/”似乎会导致故障。即使路由不存在,考虑到指定的路由“calendarsindex”不存在,它也应该以与下一个路由相同的方式失败。结果路由的存在并不重要,因为这只是为了测试映射是否有效。你知道怎么解决这个问题吗 match '/login' => 'admin/calendars#index' # this one should actually work, but fails: The recognized
match '/login' => 'admin/calendars#index' # this one should actually work, but fails:
The recognized options <{"controller"=>"errors", "action"=>"handle404", "a"=>"login"}> did not match <{"controller"=>"go", "action"=>"index"}>, difference: <{"controller"=>"go", "action"=>"index", "a"=>"login"}>.
您构建的测试路线错误:
match '/login' => 'calendars#index' #this one fails as expected:
The recognized options <{"controller"=>"calendars", "action"=>"index"}> did not match <{"controller"=>"go", "action"=>"index"}>, difference: <{"controller"=>"go"}>
应该读到:
it "should match login for existing account" do
{ :get => 'http://www.' + @business.subdomain + '.lvh.me:3000/login' }.should route_to({:controller => "go", :action => "index"})
end
假设您不想测试etc您构建的测试路线是错误的:
match '/login' => 'calendars#index' #this one fails as expected:
The recognized options <{"controller"=>"calendars", "action"=>"index"}> did not match <{"controller"=>"go", "action"=>"index"}>, difference: <{"controller"=>"go"}>
应该读到:
it "should match login for existing account" do
{ :get => 'http://www.' + @business.subdomain + '.lvh.me:3000/login' }.should route_to({:controller => "go", :action => "index"})
end
假设您不想测试等等