Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kazufumi-nishida-www committed Dec 26, 2018
1 parent d13e205 commit 1c8eebd
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions README.md
Expand Up @@ -15,3 +15,60 @@ libraryDependencies += "com.github.bigwheel" %% "scalatest-structured-before" %
## Usage

Check [test code](https://github.com/bigwheel/scalatest-structured-before/blob/master/src/test/scala/com/github/bigwheel/scalatest/FunSpecExSpec.scala).

```scala
class FunSpecExSpec extends FunSpecEx with Matchers {

var subject: Int = _

describeWithText("description can be used in test") { desc =>
it ("like this") {
desc should be("description can be used in test")
}
}

describeWithBefore("When initialized by 0"){ subject = 0 } {
it("is 0") {
subject should be(0)
}

describeWithBefore("when + 5"){ subject += 5 } {
it("is 5") {
subject should be(5)
}

describeWithBefore("then - 3"){ subject -= 3 } {
it("is 2") {
subject should be(2)
}
it("also is even") {
(2 % 2) should be (0)
}
}

describeWithTextAndBefore("and * -1"){ subject *= -1 } { desc =>
it("is -5") {
subject should be(-5)
}
it("desc can be used in test") {
desc should be ("and * -1")
}
}
}

describe("with normal description") {
describeWithBefore("works correctly (+ 9)") { subject += 9 } {
it("is 9") {
subject should be(9)
}

they("`they` also be able to be used") {
subject should be(9)
}
}
}

}

}
```

0 comments on commit 1c8eebd

Please sign in to comment.