Rails 根测试
Rails root test
我是初学者,正在尝试测试以下代码是否映射到 "home page":
Rails.application.routes.draw do
root 'static_pages#home'
end
我应该用什么替换下面块中的第一个和第二个 "FILL_IN"?
test "should get root" do
get FILL_IN
assert_response FILL_IN
end
感谢您的帮助!
我假设您正在关注 Micheal Hartl 的 "Ruby on Rails Tutorial"?
具体这一步:Listing 3.42: A test for the root route
虽然在教程中没有明确披露(如果我错了请纠正我)...
我相信下面的解决方案将通过您的测试。我自己试过仔细检查。
test "should get root" do
get '/'
assert_response :success
end
可在此处找到更多阅读材料:Rails Guide - Integration Tests
类似的帖子:By filling in the code marked FILL_IN in Listing 3.42, write a test for the root route
我是初学者,正在尝试测试以下代码是否映射到 "home page":
Rails.application.routes.draw do
root 'static_pages#home'
end
我应该用什么替换下面块中的第一个和第二个 "FILL_IN"?
test "should get root" do
get FILL_IN
assert_response FILL_IN
end
感谢您的帮助!
我假设您正在关注 Micheal Hartl 的 "Ruby on Rails Tutorial"?
具体这一步:Listing 3.42: A test for the root route
虽然在教程中没有明确披露(如果我错了请纠正我)...
我相信下面的解决方案将通过您的测试。我自己试过仔细检查。
test "should get root" do
get '/'
assert_response :success
end
可在此处找到更多阅读材料:Rails Guide - Integration Tests
类似的帖子:By filling in the code marked FILL_IN in Listing 3.42, write a test for the root route