得到以下錯誤,當我運行「捆綁高管rspec的投機/請求/ static_pages_spec.rb:爲什麼我在RSpec中遇到這些故障?
9 examples, 2 failures
Failed examples:
rspec ./spec/requests/static_pages_spec.rb:56 # Static pages Contact page should have the title 'Contact page'
rspec ./spec/requests/static_pages_spec.rb:51 # Static pages Contact page should have the content 'Contact page'
我無法弄清楚如何讓這兩個測試通過這裏。
試圖通過教程到這裏,學習,很新(我相信這是代碼):
describe "Contact page" do
it "should have the content 'Contact'" do
visit '/static_pages/contact'
expect(page).to have_content('Contact')
end
it "should have the title 'Contact'" do
visit '/static_pages/contact'
expect(page).to have_content("Ruby on Rails Tutorial Sample App | Contact")
end
end
end
此外,HTML文件:
<% provide(:title, 'Contact') %>
<h1>Contact</h1>
<p>
Contact Ruby on Rails Tutorial about the sample app at the
<a href="http://railstutorial.org/contact">contact page</a>.
</p>
沒有看到規範和規範正在處理的代碼,沒有人可以幫助你。 – sevenseacat
如果不知道代碼和測試,我無法弄清楚。 –
這有幫助嗎? – user2698988