I would like to test whether a flash message contains certain text. So I have the line:
assert_select flash[:info], "Your fee is valid till"
This however fails with the error message:
DEPRECATION WARNING: The assertion was not run because of an invalid css selector.
unexpected '#' after ''
Does anyone understand what I'm doing wrong?
Try This.
assert_equal "Your fee is valid till", flash[:info]
OR
assert_select 'div.alert-info', flash[:info]
Only to test the message you don't need assert_select
. Only assert
would do.
If you wan to test printed HTML then use assert_select
. First argument for assert_select
is a HTML selector, like div
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With