github.com/paketo-buildpacks/packit@v1.3.2-0.20211206231111-86b75c657449/internal/fail_test.go (about) 1 package internal_test 2 3 import ( 4 "testing" 5 6 "github.com/paketo-buildpacks/packit/internal" 7 "github.com/sclevine/spec" 8 9 . "github.com/onsi/gomega" 10 ) 11 12 func testFail(t *testing.T, context spec.G, it spec.S) { 13 var ( 14 Expect = NewWithT(t).Expect 15 ) 16 17 it("acts as an error", func() { 18 fail := internal.Fail 19 Expect(fail).To(MatchError("failed")) 20 }) 21 22 context("when given a message", func() { 23 it("acts as an error with that message", func() { 24 fail := internal.Fail.WithMessage("this is a %s", "failure message") 25 Expect(fail).To(MatchError("this is a failure message")) 26 }) 27 }) 28 }