Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 Michael Hartl RoR教程第12章练习2_Ruby On Rails 4 - Fatal编程技术网

Ruby on rails 4 Michael Hartl RoR教程第12章练习2

Ruby on rails 4 Michael Hartl RoR教程第12章练习2,ruby-on-rails-4,Ruby On Rails 4,对于已完成此练习的学员,填写的内容是: test "feed on Home page" do get root_path @user.feed.paginate(page: 1).each do |micropost| assert_match CGI.escapeHTML(FILL_IN), FILL_IN end end 谢谢您应该将micropost内容与body response相匹配,它看起来是这样的: test "feed on Home page" do

对于已完成此练习的学员,填写的内容是:

test "feed on Home page" do
  get root_path
  @user.feed.paginate(page: 1).each do |micropost|
    assert_match CGI.escapeHTML(FILL_IN), FILL_IN
  end
end

谢谢

您应该将micropost内容与body response相匹配,它看起来是这样的:

test "feed on Home page" do
  get root_path
  @user.feed.paginate(page: 1).each do |micropost|
    assert_match CGI.escapeHTML(micropost.content), response.body
  end
end