Skip to content

Instantly share code, notes, and snippets.

@dhinojosa
Created February 2, 2012 21:59
Show Gist options
  • Save dhinojosa/1726050 to your computer and use it in GitHub Desktop.
Save dhinojosa/1726050 to your computer and use it in GitHub Desktop.
Compounded Messages
package com.oreilly.testingscala
import org.specs2.Specification
import org.specs2.execute.{NoDetails, Failure, Result, Details}
class RunningAllTestsSpecification extends Specification {
def is =
"Using the same shared instance of Barry White add some albums" ^ runItems
def runItems = {
var i = 0
val list = List[Result](
{(i = i+1); i must be_== (1)},
{(i = i+1); i must be_== (10)},
{(i = i+1); i must be_== (3)},
{(i = i+1); i must be_== (7)})
val failures = list.view.filter(_.isInstanceOf[Failure]).force
new Failure(failures.foldLeft("")(_ + _.message +"\n"), failures.foldLeft("")(_ + _.expected + "\n"), Nil, NoDetails())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment