Capybara——如何检查包含换行符的内容
假设我的 HTML 输出...
<p>foo<p>...
...检查“foo”是否是该行中的最后一个文本非常重要。
使用水豚检查线路返回的最快方法是什么?
Then I should see "foo\n"
不适合我。
错误是:
expected #has_content?("Cached Slug: foo\\n") to return true, got false (RSpec::Expectations::ExpectationNotMetError)
以下内容有效,但当然不会检查行返回:
Then I should see "foo"
Say that my HTML outputs...
<p>foo<p>...
...and it's important to check that 'foo' is the last text in the line.
What's the quickest way to check for the line return using Capybara?
Then I should see "foo\n"
is not working for me.
The error is:
expected #has_content?("Cached Slug: foo\\n") to return true, got false (RSpec::Expectations::ExpectationNotMetError)
The following works, but of course doesn't check for the line return:
Then I should see "foo"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你尝试过吗
Have you tried