我的 html 代码中有这个字符串:
1\n \n word
我想创建一个忽略那些新行和空格的 assert_select,所以我试过这个:
assert_select ".myclass", /1.+word/
但它不起作用:
1) Failure:
test_new_line(NewLineControllerTest) [test/functional/new_line_controller_test.rb:23]:
</1.+word/> expected but was
<"1\n \n word">.
我该如何解决?
最佳答案
您需要指定多行标志,因为该字符串中有多行。
assert_select ".myclass", /1.+word/m
关于ruby-on-rails - 如何 assert_select 一个字符串里面有一个新行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11473660/