github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/util/manifestparser/process_test.go (about)

     1  package manifestparser_test
     2  
     3  import (
     4  	. "code.cloudfoundry.org/cli/util/manifestparser"
     5  
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/gomega"
     8  )
     9  
    10  var _ = Describe("Process", func() {
    11  	Describe("SetStartCommand", func() {
    12  		var (
    13  			process Process
    14  			command string
    15  		)
    16  
    17  		BeforeEach(func() {
    18  			process = Process{}
    19  			command = "./start.sh"
    20  		})
    21  
    22  		JustBeforeEach(func() {
    23  			process.SetStartCommand(command)
    24  		})
    25  
    26  		When("the remaining fields map exists", func() {
    27  			BeforeEach(func() {
    28  				process.RemainingManifestFields = map[string]interface{}{}
    29  			})
    30  
    31  			It("sets the start command in the map", func() {
    32  				Expect(process.RemainingManifestFields["command"]).To(Equal("./start.sh"))
    33  			})
    34  
    35  			When("the command is nil", func() {
    36  				BeforeEach(func() {
    37  					command = ""
    38  				})
    39  
    40  				It("sets the start command to nil in the map", func() {
    41  					Expect(process.RemainingManifestFields["command"]).To(BeNil())
    42  				})
    43  			})
    44  		})
    45  
    46  		When("the remaining fields map does not exist", func() {
    47  			It("sets the start command in the map", func() {
    48  				Expect(process.RemainingManifestFields["command"]).To(Equal("./start.sh"))
    49  			})
    50  		})
    51  	})
    52  })