Skip to content

Instantly share code, notes, and snippets.

@cbron
Created October 11, 2019 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbron/1c33866c516c283b4bf889bdc9bebc26 to your computer and use it in GitHub Desktop.
Save cbron/1c33866c516c283b4bf889bdc9bebc26 to your computer and use it in GitHub Desktop.
Base spec test
package integration
import (
"fmt"
"testing"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
)
func TestObject(t *testing.T) {
spec.Run(t, "object", func(t *testing.T, when spec.G, it spec.S) {
it.Before(func() {
fmt.Println("Before")
})
it.After(func() {
fmt.Println("After")
})
when("when", func() {
it("it-a", func() {
fmt.Println("it-a")
})
it("it-b", func() {
fmt.Println("it-b")
})
}, spec.Flat())
}, spec.Report(report.Terminal{}))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment