Assert_not_in_array

We have a statement in rails tests assert_in_array that is used to check if an element exists in an array. Is there any converse statement for it like assert_not_in_array?

+3
source share
2 answers

There is no such statement, however you can do this:

assert (not array.include? element)
+12
source

You may be looking for refute_includes

 refute_includes array_of_user_ids, user.id

http://apidock.com/ruby/v1_9_3_392/MiniTest/Assertions/refute_includes

+2
source

Source: https://habr.com/ru/post/1781780/


All Articles