These are chat archives for etorreborre/specs2

21st
Apr 2017
G. Richard Bellamy
@rbellamy
Apr 21 2017 15:52
what's the proper idiom for returning a MatchResult for a test which asserts that the contents of one list is equal to the contents of another?
so sorry - of course, ask the question publicly, find the answer seconds or minutes later.
Maravedis
@ClementMalaingre
Apr 21 2017 15:55
seq should contain theSameElementsAs Seq(Right(id1), Right(id2))
Oh, right, you answered yourself, sorry ^^
G. Richard Bellamy
@rbellamy
Apr 21 2017 15:57
Selection 909x792 20170421085613.png
something not quite right with the doco - looks like the anchor is missing a closing tag?
If you mouse over the body of the text, it becomes a link to the anchor of the section header....
@etorreborre ---^
@ClementMalaingre yeah, heh, found it - ended up with seq should contain(allOf(anotherSeq))
Maravedis
@ClementMalaingre
Apr 21 2017 16:00
Here, you'll have correct if seq.size > anotherSeq.size if seq contains anotherSeq.
Eric Torreborre
@etorreborre
Apr 21 2017 16:02
@rbellamy yes that doesn't look good. There used to be tabs for each matcher type, it seems totally broken now
G. Richard Bellamy
@rbellamy
Apr 21 2017 16:36
want me to create an issue? Wish I had the time to submit a PR - my current excuse is that I'm headed to a release deadline and am buried trying to make that happen...
huh, @ClementMalaingre maybe I'll try your stanza... mine is barking at me and invariance...
G. Richard Bellamy
@rbellamy
Apr 21 2017 23:35
okay, it's official, this seq must contain(anotherSeq) is kicking my ass
      val listingStatuses: Vector[ListingStatus] = Seq(ListingStatus.ACTIVE, ListingStatus.PENDING, ListingStatus.SOLD).toVector
      val statuses: Seq[ListingStatus] = Seq(ListingStatus.ACTIVE, ListingStatus.PENDING, ListingStatus.SOLD)
      listingStatuses must contain(statuses) // fails
with an error something like this:
Vector(ACTIVE, PENDING, SOLD) does not contain List(ACTIVE, PENDING, SOLD) (CrtAssemblySpec.scala:84)
[error] Actual:   ACTIVE
[error] Expected: List(ACTIVE, PENDING, SOLD)
G. Richard Bellamy
@rbellamy
Apr 21 2017 23:41
anybody have some love for me here? I've been beating my head against the wall for several hours, and this just doesn't seem right...
G. Richard Bellamy
@rbellamy
Apr 21 2017 23:50
I'm clearly missing something, since this worked:
 val listingStatuses: Vector[ListingStatus] = Seq(ListingStatus.ACTIVE, ListingStatus.PENDING, ListingStatus.SOLD).toVector
 val statuses: Seq[ListingStatus] = Seq(ListingStatus.ACTIVE, ListingStatus.PENDING, ListingStatus.SOLD)
listingStatuses must containTheSameElementsAs(statuses)