Skip to content

Commit

Permalink
Simplify PathFinder test
Browse files Browse the repository at this point in the history
  • Loading branch information
aramprice authored and ramonskie committed May 26, 2023
1 parent 077928b commit 3e594a9
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions helpers/path_finder_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package helpers_test

import (
"crypto/rand"

"github.com/cloudfoundry/bosh-bootloader/helpers"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -15,29 +13,15 @@ var _ = Describe("PathFinder", func() {
})

Describe("CommandExists", func() {
var command string
Context("when a command does not exist", func() {
BeforeEach(func() {
commandBytes := make([]byte, 32)

_, err := rand.Read(commandBytes)
Expect(err).NotTo(HaveOccurred())

command = string(commandBytes)
})

It("returns false", func() {
Expect(pathFinder.CommandExists(command)).To(BeFalse())
Expect(pathFinder.CommandExists("non-existent-command")).To(BeFalse())
})
})

Context("when a command exists", func() {
BeforeEach(func() {
command = "ginkgo"
})

It("returns true", func() {
Expect(pathFinder.CommandExists(command)).To(BeTrue())
Expect(pathFinder.CommandExists("ls")).To(BeTrue())
})
})
})
Expand Down

0 comments on commit 3e594a9

Please sign in to comment.