相关疑难解决方法(0)

Rspec测试页面内容中的html实体

我正在编写请求规范,并希望测试字符串"Reports»Aging Reports"的存在.如果我直接在我的matcher表达式中输入字符,我会收到一个错误(无效的多字节字符),所以我尝试了这个:page.should have_content("Reports » Aging Reports")

这使测试失败并显示以下消息:

expected there to be content "Reports » Aging Reports" in "\n Reports » Aging Reports\n

我尝试过.html_safe没有成功的事情.有没有办法测试包含html实体的文本?

编辑:

这是html源代码的相关区域:

<a href="/reports">Reports</a> &raquo; <a href="/aging_reports">Aging Reports</a>

ruby rspec ruby-on-rails html-entities

12
推荐指数
3
解决办法
1万
查看次数

标签 统计

html-entities ×1

rspec ×1

ruby ×1

ruby-on-rails ×1