我正在尝试用rspec测试路由.以下给出了“预期块返回真值”的错误.
我不知道我失踪了什么通过浏览器,我可以发布到这个url,它是成功的.
有任何想法吗?谢谢!
路线
resources :forum_topics do resources :forum_sub_topics end
测试:
it "recognizes and generates nested #create" do { :post => "/forum_topics/1/forum_sub_topics" }.should route_to(:controller => "forum_sub_topics",:action => "create",:forum_topic_id => 1) end
解决方法
没有人正式回答我的问题,所以我会:)
{ :post => "/forum_topics/1/forum_sub_topics" }.should route_to(:controller => "forum_sub_topics",:forum_topic_id => 1)
归结为:forum_topic_id => 1不等于:forum_topic_id => “1”也许我的PHP日子已经爬了起来咬我.字符串和整数:)