github.com/randomtask1155/cli@v6.41.1-0.20181227003417-a98eed78cbde+incompatible/actor/pushaction/command_line_settings_unix_test.go (about) 1 // +build !windows 2 3 package pushaction_test 4 5 import ( 6 . "code.cloudfoundry.org/cli/actor/pushaction" 7 "code.cloudfoundry.org/cli/util/manifest" 8 9 . "github.com/onsi/ginkgo" 10 . "github.com/onsi/ginkgo/extensions/table" 11 . "github.com/onsi/gomega" 12 ) 13 14 var _ = Describe("CommandLineSettings with provided path", func() { 15 const currentDirectory = "/some/current-directory" 16 17 Describe("OverrideManifestSettings", func() { 18 DescribeTable("Path", func(providedAppPath string, manifestPath string, expectedPath string) { 19 settings := CommandLineSettings{ 20 CurrentDirectory: currentDirectory, 21 ProvidedAppPath: providedAppPath, 22 } 23 24 app := settings.OverrideManifestSettings(manifest.Application{ 25 Path: manifestPath, 26 }) 27 28 Expect(app.Path).To(Equal(expectedPath)) 29 }, 30 31 Entry("path = current directory; provided and manifest paths are empty", "", "", currentDirectory), 32 Entry("path = manfiest path; provided is empty and manifest path is not empty", "", "some-manifest-path", "some-manifest-path"), 33 Entry("path = absolute provided path; provided relative path is not empty and manifest path is empty", "some-provided-path", "", "some-provided-path"), 34 Entry("path = absolute provided path; provided relative path and manifest path are not empty", "some-provided-path", "some-manifest-path", "some-provided-path"), 35 Entry("path = provided path; provided path is absolute", "/some-provided-path", "", "/some-provided-path"), 36 ) 37 38 When("docker image is provided but path is not", func() { 39 When("the image is provided via command line setting", func() { 40 It("does not set path", func() { 41 settings := CommandLineSettings{ 42 CurrentDirectory: currentDirectory, 43 DockerImage: "some-image", 44 } 45 46 app := settings.OverrideManifestSettings(manifest.Application{}) 47 48 Expect(app.Path).To(BeEmpty()) 49 }) 50 }) 51 52 When("the image is provided via manifest", func() { 53 It("does not set path", func() { 54 settings := CommandLineSettings{ 55 CurrentDirectory: currentDirectory, 56 } 57 58 app := settings.OverrideManifestSettings(manifest.Application{ 59 DockerImage: "some-image", 60 }) 61 62 Expect(app.Path).To(BeEmpty()) 63 }) 64 }) 65 }) 66 }) 67 })