3

私は私の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">.

どうすれば修正できますか?

4

1 に答える 1

4

その文字列には複数の行があるため、複数行フラグを指定する必要があります。

assert_select ".myclass", /1.+word/m
于 2012-07-13T15:48:43.587 に答える