Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 当route'match'语句列出子目录(或嵌套路由)时,RSpec似乎中断_Ruby On Rails_Rspec_Rspec2 - Fatal编程技术网

Ruby on rails 当route'match'语句列出子目录(或嵌套路由)时,RSpec似乎中断

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

此处确实存在特定的controllerroute,但目录/嵌套路由“admin/”似乎会导致故障。即使路由不存在,考虑到指定的路由“calendarsindex”不存在,它也应该以与下一个路由相同的方式失败。结果路由的存在并不重要,因为这只是为了测试映射是否有效。你知道怎么解决这个问题吗

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
假设您不想测试等等