對於確定側邊欄行爲的控制器,我需要調用多個url;側欄會根據它出現的頁面更改(a.o)。在rspec測試中獲取url或路徑(作爲字符串提供)
describe SidebarController do
before(:each) do
@sidebar = SidebarController.new
end
it 'should return :jobseekers for root_path' do
get(root_url)
@sidebar.section(root_path).should eq :jobseekers
end
end
然而,這失敗ActionController::RoutingError: No route matches {:controller=>"sidebar", :action=>"http://test.host/"}
我可以get
的URL或路徑字符串?有沒有更智能的方法來設置request.
數據,而不是獲取它?