论坛首页 编程语言技术论坛

测试代码笔记-RailsSpace

浏览 1545 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (6) :: 隐藏帖 (2)
作者 正文
   发表时间:2009-03-16   最后修改:2009-03-16
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