github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/actor/pushaction/command_line_settings_windows_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 = "C:\\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", "C:\\some\\path", "C:\\some\\path"),
    28  			Entry("path = full path to provided path; provided path is relative", ".\\some-path", "C:\\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", "", "C:\\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", "C:\\some\\current-directory\\some-provided-path"),
    50  			Entry("path = provided path; provided path is absolute", "C:\\some-provided-path", "", "C:\\some-provided-path"),
    51  		)
    52  	})
    53  })