Skip to content
Browse files

Merge branch 'fix-example-spec' of git://github.com/kxbmap/scalikejdb…

…c-async into kxbmap-fix-example-spec
  • Loading branch information...
2 parents 2f62c48 + 891be57 commit d948b6a9abe2587e9a77975d5c7b17ed274fb159 @seratch seratch committed Feb 7, 2014
Showing with 7 additions and 2 deletions.
  1. +7 −2 core/src/test/scala/programmerlist/ExampleSpec.scala
View
9 core/src/test/scala/programmerlist/ExampleSpec.scala
@@ -37,8 +37,13 @@ class ExampleSpec extends FlatSpec with ShouldMatchers with DBSettings with Logg
// delete a record and rollback
val withinTx: Future[Unit] = AsyncDB.localTx { implicit tx =>
for {
- restructuring <- Programmer.findAllBy(sqls.eq(p.companyId, newCompany.id)).map { programmers =>
- programmers.foreach(_.destroy())
+ programmers <- Programmer.findAllBy(sqls.eq(p.companyId, newCompany.id))
+ restructuring <- programmers.foldLeft(Future.successful()) {
+ (prev, programmer) =>
+ for {
+ _ <- prev
+ _ <- programmer.destroy()
+ } yield ()
}
dissolution <- newCompany.destroy()
_ <- sql"Just joking!".update.future

0 comments on commit d948b6a

Please sign in to comment.
Something went wrong with that request. Please try again.