tstone / specs2-exter

Extra goodies for specs2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exter

A collection of matchers and language enhancements to add a bit of polish to your specs2 specs.

Build & Installation

Not yet on maven central.

1.) Clone repository
$ git clone --depth 10 git@github.com:tstone/specs2-exter.git
2.) Build
$ cd specs2-exter
$ sbt package
3.) Copy jar to your projet's lib folder
$ cp target/scala-2.11/specs2-exter_2.11-1.0.0-pre.jar ../your-project/lib
4.) Add the dependency to your sbt build file
"org.specs2.exter" %% "specs2-exter" % "1.0.0-pre" % "test"

Notifiers

Minimal (notifier)

A mocha-inspired runner that prints only dots for examples executed. Errors are shown in an abbreviated format.

Note: There is a bug in Specs2 that prevents notifiers from working correctly on versions < 2.4.

screenshot

Use

Add the following to your build.sbt or Build.scala:

testOptions in Test += Tests.Argument("notifier org.specs2.exter.notifier.Minimal")

Matchers

Use

Mixin the matcher trait with the Specification class to get access to matchers.

Exter      // all matchers
ExterSeq   // only matchers for Seq
Example:
import org.specs2.exter.matcher.Exter

class FooSpec extends SpecificationLike with Exter {
  // ...
}

Included Matchers

containAll (Seq)

Assert that a given sequence contains all of the listed elements, regardless of order.

val seq = Seq(3, 1, 5, 4, 2)
seq must containAll(1, 2, 3) // true
seq must containAll(4, 5, 6) // false (missing 6)
seq must containAll(6, 7, 8) // false (missing all)

containExactly (Seq)

Assert that a given sequence contains all and no more of the listed elements, regardless of order.

val seq = Seq(3, 2, 1)
seq must containExactly(1, 2, 3) // true
seq must containExactly(1, 2)    // false
seq must containExactly(3, 4, 5) // false

containSome (Seq)

Assert that at least one of the listed elements is within the given sequence

val seq = Seq(2, 4, 6)
seq must containSome(6, 8, 10)  // true
seq must containSome(6, 4, 2)   // true
seq must containSome(8, 10, 12) // false

About

Extra goodies for specs2

License:MIT License


Languages

Language:Scala 100.0%