-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathhelp_test.go
More file actions
36 lines (29 loc) · 885 Bytes
/
help_test.go
File metadata and controls
36 lines (29 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package _tests_test
import (
"fmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
const noMatch string = "Found no matching command, try 'deis help'"
const usage string = "Usage: deis <command> [<args>...]"
var _ = Describe("Help", func() {
for _, flag := range []string{"--help", "-h", "help"} {
It(fmt.Sprintf("prints help on \"%s\"", flag), func() {
output, err := execute("deis " + flag)
Expect(err).NotTo(HaveOccurred())
Expect(output).To(ContainSubstring(usage))
})
}
It("defaults to a usage message", func() {
output, err := execute("deis")
Expect(err).To(HaveOccurred())
Expect(output).To(ContainSubstring(usage))
})
It("rejects a bogus command", func() {
output, err := execute("deis bogus-command")
Expect(err).To(HaveOccurred())
Expect(output).To(SatisfyAll(
ContainSubstring(noMatch),
ContainSubstring(usage)))
})
})