How to test the opposite of assert_text in Ruby on Rails
Asked Answered
S

1

7

I want to be sure my page does not contain certain text, I know there is an assert_text function, but, how do I test the opposite?

I am using RoR 6.0, the default test framework (I think it is Test Unit) and capybara

Salicin answered 9/11, 2019 at 2:51 Comment(0)
U
9

Rails 6 is using Minitest and Capybara by default.

assert_text comes from Capybara, or to be more precise, from Capybara::Minitest::Assertions.

As you can see in Capybara::Minitest::Assertions, there is an assertion called assert_no_text, which, I suppose, does exactly what you need.

Further details can be found here.

And this is a link to a quick explanation of the difference between Test::Unit and Minitest.

Hope this helps.

Uther answered 9/11, 2019 at 20:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.