djspiewak / smock

A utility harness for testing free programs (built on specs2)
Apache License 2.0
29 stars 3 forks source link

version without specs2 dependency? #4

Closed fommil closed 6 years ago

fommil commented 6 years ago

It would be great if the Harness was available without the specs2 dependency.

fommil commented 6 years ago

FYI I ended up creating a very minimal version of smock for my usecase, I'm sure you'll recognise the hack:

object Mocker {
  final class Stub[A] {
    def apply[F[_], G[_]](pf: PartialFunction[F[A], G[A]]): F ~> G = new (F ~> G) {
      override def apply[α](fa: F[α]): G[α] = pf.asInstanceOf[PartialFunction[F[α], G[α]]](fa)
    }
  }
  def stub[A]: Stub[A] = new Stub[A]
}
fommil commented 6 years ago

meh, if you're porting to cats anyway that's not interesting to me.