Skip to content

Instantly share code, notes, and snippets.

View erikvanoosten's full-sized avatar

Erik van Oosten erikvanoosten

View GitHub Profile
@erikvanoosten
erikvanoosten / gist:1059045
Created July 1, 2011 17:40
Example of a specs2 unit test, with mocks and rich context
import org.specs2.mutable._
import org.specs2.mock._
import org.specs2.specification.Scope
class ParentElementStrategyTest extends SpecificationWithJUnit with Mockito {
"The ParentElementStrategy" should {
"extract a user ref" in new SimpleContext {
val testColumn = mock[Column]
registry.get("urn:grons.nl:user:9475877") returns testColumn
userStrategy("user").getShardForEntity(ad, columns) must beTheSameAs(testColumn)