1 describe "Home page" do 2 3 it "should have the content 'Sample App'" do 4 visit '/static_pages/home' #使用了Capybara中的visit函数来模拟在浏览器中访问/static_pages/home的操作 5 expect(page).to have_content('Sample App') #使用了Capybara中的page变量来测试页面中是否包含了正确的内容 6 end 7 end