These are chat archives for etorreborre/specs2

13th
Aug 2018
Andrzej Sołtysik
@asoltysik
Aug 13 2018 09:35
Hi, is there a way to mock/spy a function inside Scala's object?
Marcin Cylke
@zygm0nt
Aug 13 2018 21:42

Hi, I'd like to create a fragment to do some environment cleaning with each example in spec. Conceptually this would look like this:

trait CleanFragments {
  this: FragmentsFactory with FragmentsDsl =>

  def preclean(fs: Fragments, cleaner: () => Unit): Fragments = {
    fs.flatMap(_.prepend(fragmentFactory.step(cleaner()))
  }

}

But the flatMap line does not work.

Could you guys help with that?