Skip to content

Make real-time assertions on file contents in gomega

Notifications You must be signed in to change notification settings

BooleanCat/gfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gfile

Build Status

gfile is an implementation of gbytes' BufferProvider interface that allows you to make assertions on the contents of files as they are updated using the ginkgo testing framework.

Installation

go get github.com/BooleanCat/gfile

Usage

Below is an example usage of gfile.Buffer to check that a logfile has had a specific message written to it.

...
Context("when writing to a log file", func() {
    var (
        buffer *gfile.Buffer
        err    error
    )

    BeforeEach(func() {
        buffer, err = gfile.NewBuffer("/tmp/foo")
        Expect(err).NotTo(HaveOccurred())
    })

    AfterEach(func() {
        err := buffer.Close()
        Expect(err).NotTo(HaveOccurred())
    })

    It("can be read back", func() {
        WriteToLog("/tmp/foo")
        Eventually(buffer).Should(gbytes.Say("I'm a log message"))
    })
})
...

About

Make real-time assertions on file contents in gomega

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages