`
zhao_j_long
  • 浏览: 3633 次
  • 性别: Icon_minigender_1
  • 来自: 唐山.
社区版块
存档分类
最新评论

测试代码笔记-RailsSpace

阅读更多
def test_about
 get :about
 title = assigns(:title)
 assert_equal "About RailsSpace", title
 [color=blue]assert_response :success[/color]
 assert_template "about"
end

assert_response :success #判断返回正确,书中的解释为
HTTP uses a numeric code to indicate the response type; the code happens to be 200 for success. You don't have to remember this, though, since Rails lets you use the symbol :success instead.
HTTP用数字来指示返回状态,返回成功时代码为200。你不需要记住,因为Rails让你用:success符号来代替
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics