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
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"}>.
此处的特定控制器#route确实存在,但目录/嵌套路由('admin /')似乎导致失败。即使路径不存在,它也应该以下一个路径的相同方式失败,考虑到那里指定的路由('calendars #index')不存在。结果路由的存在无关紧要 - 因为这只能测试映射是否有效。知道怎么解决这个问题吗?
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"}>
答案 0 :(得分:0)
您的测试路线构建错误:
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
应该是:
it "should match login for existing account" do
{ :get => 'http://' + @business.subdomain + '.lvh.me:3000/login' }.should route_to({:controller => "go", :action => "index"})
end