In my rspec integration tests, when I have an assertion such as:
assert page.has_content? some_value
if the assertion fails, it displays:
MiniTest::Assertion:
Failed assertion, no message given
The minitest docs say "All assertion methods accept a msg which is printed if the assertion fails" but I cannot find any examples of HOW to specify the message. These are NOT valid syntax:
assert("custom fail msg") page.has_content? some_value
assert page.has_content? some_value, "custom fail msg"
Try:
assert page.has_content?(some_value), "custom fail msg"
Assuming I have reproduced your error properly, the issue with your second attempt is that Ruby thinks that "custom fail msg" is a parameter of the page.has_content?
rather than the assert
. Adding the brackets around the paramaters for the page.has_content?
should resolve the issue.
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