github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/actor/pushaction/command_line_settings_unix_test.go (about) 1 // +build !windows 2 3 package pushaction_test 4 5 import ( 6 . "github.com/liamawhite/cli-with-i18n/actor/pushaction" 7 "github.com/liamawhite/cli-with-i18n/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("ApplicationPath with provided path", func() { 18 DescribeTable("ApplicationPath", func(providedAppPath string, expectedPath string) { 19 settings := CommandLineSettings{ 20 CurrentDirectory: currentDirectory, 21 ProvidedAppPath: providedAppPath, 22 } 23 24 Expect(settings.ApplicationPath()).To(Equal(expectedPath)) 25 }, 26 27 Entry("path = provided path; provided path is absolute", "/some/path", "/some/path"), 28 Entry("path = full path to provided path; provided path is relative", "./some-path", "/some/current-directory/some-path"), 29 ) 30 }) 31 32 Describe("OverrideManifestSettings", func() { 33 DescribeTable("Path", func(providedAppPath string, manifestPath string, expectedPath string) { 34 settings := CommandLineSettings{ 35 CurrentDirectory: currentDirectory, 36 ProvidedAppPath: providedAppPath, 37 } 38 39 app := settings.OverrideManifestSettings(manifest.Application{ 40 Path: manifestPath, 41 }) 42 43 Expect(app.Path).To(Equal(expectedPath)) 44 }, 45 46 Entry("path = current directory; provided and manifest paths are empty", "", "", currentDirectory), 47 Entry("path = manfiest path; provided is empty and manifest path is not empty", "", "some-manifest-path", "some-manifest-path"), 48 Entry("path = absolute provided path; provided relative path is not empty and manifest path is empty", "some-provided-path", "", "/some/current-directory/some-provided-path"), 49 Entry("path = absolute provided path; provided relative path and manifest path are not empty", "some-provided-path", "some-manifest-path", "/some/current-directory/some-provided-path"), 50 Entry("path = provided path; provided path is absolute", "/some-provided-path", "", "/some-provided-path"), 51 ) 52 }) 53 })