scalatest-structured-before


License

License

Categories

Categories

Scala Languages
GroupId

GroupId

com.github.bigwheel
ArtifactId

ArtifactId

scalatest-structured-before_2.12
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

scalatest-structured-before
scalatest-structured-before
Project URL

Project URL

https://github.com/bigwheel/scalatest-structured-before
Project Organization

Project Organization

com.github.bigwheel
Source Code Management

Source Code Management

https://github.com/bigwheel/scalatest-structured-before

Download scalatest-structured-before_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.bigwheel/scalatest-structured-before_2.12/ -->
<dependency>
    <groupId>com.github.bigwheel</groupId>
    <artifactId>scalatest-structured-before_2.12</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.bigwheel/scalatest-structured-before_2.12/
implementation 'com.github.bigwheel:scalatest-structured-before_2.12:1.0.1'
// https://jarcasting.com/artifacts/com.github.bigwheel/scalatest-structured-before_2.12/
implementation ("com.github.bigwheel:scalatest-structured-before_2.12:1.0.1")
'com.github.bigwheel:scalatest-structured-before_2.12:jar:1.0.1'
<dependency org="com.github.bigwheel" name="scalatest-structured-before_2.12" rev="1.0.1">
  <artifact name="scalatest-structured-before_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.bigwheel', module='scalatest-structured-before_2.12', version='1.0.1')
)
libraryDependencies += "com.github.bigwheel" % "scalatest-structured-before_2.12" % "1.0.1"
[com.github.bigwheel/scalatest-structured-before_2.12 "1.0.1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.6
org.scalactic : scalactic_2.12 jar 3.0.5
org.scalatest : scalatest_2.12 jar 3.0.5
org.scalaz : scalaz-core_2.12 jar 7.2.26

Project Modules

There are no modules declared in this project.

scalatest-structured-before

This is a expansion of FunSpec of scalatest.

Installation

Available from maven central.

If you use SBT you can include util-backports in your project with

libraryDependencies += "com.github.bigwheel" %% "scalatest-structured-before" % "1.0"

Usage

Check test code.

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)
        }
      }
    }

  }

}

Versions

Version
1.0.1
1.0