rspec:如何期望该页面具有所需的 html

rspec: How to expect that page has the desired html

我有以下 html 是我从启动页面源代码中获取的。

    <dt title="No. days">No. days:</dt>
    <dd>7</dd>

在我的测试中,我必须期待相同的 html,我在下面尝试过

expect(page.html).to include("<dt title=\"No. days\">No. days:</dt><dd>7</dd>")

但是得到了错误。 我需要在包含中写什么格式才能期望相同的 html

提前致谢

String 不安全 HTML.

expect(page).to have_selector('dt[title="No. days"]', text: "No. days:")
expect(page).to have_selector('dd', text: "7")