Module | Shoulda::Assertions |
In: |
lib/shoulda/assertions.rb
|
Asserts that the given collection contains item x. If x is a regular expression, ensure that at least one element from the collection matches x. extra_msg is appended to the error message if the assertion fails.
assert_contains(['a', '1'], /\d/) => passes assert_contains(['a', '1'], 'a') => passes assert_contains(['a', '1'], /not there/) => fails
Asserts that the given collection does not contain item x. If x is a regular expression, ensure that none of the elements from the collection match x.