These are chat archives for etorreborre/specs2

13th
Aug 2015
Adisorn Chockaumnuai
@armeo
Aug 13 2015 09:45
can not resolve package "org.specs2.mockito" in spec2-core_2.11:3.6.4
Michael Hohl
@hohl
Aug 13 2015 15:14
Let's say I've got an s: Seq[SomeClass] and I'm wanting to check if this sequence have one item which member x is equal to "abc". So I tried something like the following: s must contain((sc: SomeClass) => sc.x must be equalTo("abc")). That works when there is only one item of s which fits to that pattern. But if there are multiple items of s and some of them don't match _.x == "abc" then it fails, even if there is one element which matches.
kevinwright
@kevinwright
Aug 13 2015 19:49
How about sticking an .atLeastOnce on the end of that?
s must contain((sc: SomeClass) => sc.x must_== "abc”).atLeastOnce
or
val iter = s.iterator.map(_.x)
iter.next must be_==("abc").eventually