commit 26fcdb1793a8e505afe36485757e69b2f3a583ea Author: Chris Brown Date: Sat Jan 31 20:09:59 2015 +0000 implement empty check diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a326cf --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# GitHub Releases Resource diff --git a/cmd/check/check.go b/cmd/check/check.go new file mode 100644 index 0000000..245c1f5 --- /dev/null +++ b/cmd/check/check.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("[]") +} diff --git a/cmd/check/check_suite_test.go b/cmd/check/check_suite_test.go new file mode 100644 index 0000000..228f4a9 --- /dev/null +++ b/cmd/check/check_suite_test.go @@ -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() +}) diff --git a/cmd/check/check_test.go b/cmd/check/check_test.go new file mode 100644 index 0000000..14330ca --- /dev/null +++ b/cmd/check/check_test.go @@ -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)) + }) +})