implement empty check

This commit is contained in:
Chris Brown
2015-01-31 20:09:59 +00:00
commit 26fcdb1793
4 changed files with 58 additions and 0 deletions

1
README.md Normal file
View File

@@ -0,0 +1 @@
# GitHub Releases Resource

7
cmd/check/check.go Normal file
View File

@@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("[]")
}

View File

@@ -0,0 +1,27 @@
package main_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
var checkPath string
func TestCheck(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Check Suite")
}
var _ = BeforeSuite(func() {
var err error
checkPath, err = gexec.Build("github.com/concourse/github-release-resource/cmd/check")
Ω(err).ShouldNot(HaveOccurred())
})
var _ = AfterSuite(func() {
gexec.CleanupBuildArtifacts()
})

23
cmd/check/check_test.go Normal file
View File

@@ -0,0 +1,23 @@
package main_test
import (
"os/exec"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
)
var _ = Describe("Check", func() {
It("outputs an empty JSON array", func() {
command := exec.Command(checkPath)
check, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
Ω(err).ShouldNot(HaveOccurred())
Eventually(check).Should(gbytes.Say(`\[\]`))
Eventually(check).Should(gexec.Exit(0))
})
})