Specs2 does provide a containsAllOf
matcher but I can't get it to work the way I want. I have two Strings A and B, and I want to test that all Chars that occur in B are present in A.
My best try so far was
A.toCharArray.toSeq must containAllOf(B.toCharArray.toSeq)
But this fails with errors like
WrappedArray(a, b, c, d, ...) does not contain S, a, V, H, I, ... and must not contain ...
How can I write a working spec for this scenario?
Currently, I've chosen this variant:
B.toSeq.map(c => A must contain(c))
I'm still open to suggestions, but if there is no cleaner solution I might (for the first time) answer my own question.
Or is this one of the cases where I suspect Specs2 to test a thing, when it actually doesn't?