0

我正在尝试结束我的测试并想检查路线。app.send("home_path") 在控制台中返回“/home”,但是当我在测试中运行它时,它会作为未定义的方法返回。

有任何想法吗?

1) StaticPages Check paths should have content Home
 Failure/Error: visit app.send("#{term.downcase}_path")
 NoMethodError:
   undefined method `home_path' for #<test::Application:0x007f917a48e078>
 # ./spec/requests/static_pages_spec.rb:18:in `block (4 levels) in <top (required)>'    

["Home", "About"].each do |term|
  describe "Check paths" do
    before(:each) do
      visit app.send("#{term.downcase}_path")
    end
    it "should have content #{term}" do
      expect(page).to have_content(term)
    end
  end
end
4

0 回答 0