github.com/jghiloni/cli@v6.28.1-0.20170628223758-0ce05fe032a2+incompatible/actor/pushaction/merge_and_validate_settings_and_manifest_test.go (about)

     1  package pushaction_test
     2  
     3  import (
     4  	"os"
     5  
     6  	. "code.cloudfoundry.org/cli/actor/pushaction"
     7  	"code.cloudfoundry.org/cli/actor/pushaction/manifest"
     8  
     9  	. "github.com/onsi/ginkgo"
    10  	. "github.com/onsi/gomega"
    11  )
    12  
    13  var _ = Describe("MergeAndValidateSettingsAndManifest", func() {
    14  	var actor *Actor
    15  
    16  	BeforeEach(func() {
    17  		actor = NewActor(nil)
    18  	})
    19  
    20  	Context("when only passed command line settings", func() {
    21  		var cmdSettings CommandLineSettings
    22  
    23  		Context("when pushing the current directory", func() {
    24  			var pwd string
    25  
    26  			BeforeEach(func() {
    27  				var err error
    28  				pwd, err = os.Getwd()
    29  				Expect(err).ToNot(HaveOccurred())
    30  
    31  				cmdSettings = CommandLineSettings{
    32  					Name:             "some-app",
    33  					CurrentDirectory: pwd,
    34  					DockerImage:      "some-image",
    35  				}
    36  			})
    37  
    38  			It("creates a manifest with only the command line settings", func() {
    39  				manifests, err := actor.MergeAndValidateSettingsAndManifests(cmdSettings, nil)
    40  				Expect(err).ToNot(HaveOccurred())
    41  				Expect(manifests).To(Equal([]manifest.Application{{
    42  					Name:        "some-app",
    43  					Path:        pwd,
    44  					DockerImage: "some-image",
    45  				}}))
    46  			})
    47  		})
    48  
    49  		Context("when the command line settings directory path is not empty", func() {
    50  			BeforeEach(func() {
    51  				cmdSettings = CommandLineSettings{
    52  					CurrentDirectory: "some-current-directory",
    53  					AppPath:          "some-directory-path",
    54  				}
    55  			})
    56  
    57  			It("uses the setting directory in the application manifest", func() {
    58  				manifests, err := actor.MergeAndValidateSettingsAndManifests(cmdSettings, nil)
    59  				Expect(err).ToNot(HaveOccurred())
    60  				Expect(manifests).To(HaveLen(1))
    61  				Expect(manifests[0].Path).To(Equal("some-directory-path"))
    62  			})
    63  		})
    64  	})
    65  
    66  	Context("when passed command line settings and manifests", func() {
    67  		// fill in here
    68  	})
    69  })