treppo / moco-scala   0.5.2

MIT License GitHub

scala dsl for moco

Scala versions: 2.11 2.10

moco-scala

Build Status

This is a scala wrapper for moco, based on the unmaintained moco-scala by Nicholas Ren. In contrast to the the previous versions by Nicholas, the Moco server does not have mutable state.

How to use

Add dependency

libraryDependencies += "org.treppo" %% "moco-scala" % "0.5.2" % Test

Quick Start

// Import dependencies
import org.treppo.mocoscala.dsl.Moco._

// Create server with port
val theServer = server(8080) when { uri("/hello") } respond { status(200) }

// Create server with random port
val theServer = server when { uri("/hello") } respond { status(200) }

// Running server and test your stuff
theServer running  { uri: URI =>
  assert(SomeHttpClient().url(uri).get.status === 200)
}

Documentation

Detailed feature documentation can be found in the doc/api.md

Also, please refer to functional tests.

Contribution:

Questions, suggestions or pull requests are more than welcome in the Issues section.

License

Licensed under the MIT license