github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+incompatible/command/translatableerror/minimum_uaa_api_version_not_met_error_test.go (about)

     1  package translatableerror_test
     2  
     3  import (
     4  	. "code.cloudfoundry.org/cli/command/translatableerror"
     5  
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/gomega"
     8  )
     9  
    10  var _ = Describe("MinimumUAAAPIVersionNotMetError", func() {
    11  	Describe("Error", func() {
    12  		When("the Command field is not empty", func() {
    13  			It("returns a template with the value of the Command field", func() {
    14  				err := MinimumUAAAPIVersionNotMetError{
    15  					Command: "--some-flag",
    16  				}
    17  
    18  				Expect(err.Error()).To(Equal("{{.Command}} requires UAA API version {{.MinimumVersion}} or higher. Update your Cloud Foundry instance."))
    19  			})
    20  		})
    21  
    22  		When("the Command field is empty", func() {
    23  			It("returns a template with the value of the CurrentVersion field", func() {
    24  				err := MinimumUAAAPIVersionNotMetError{}
    25  
    26  				Expect(err.Error()).To(Equal("This command requires UAA API version {{.MinimumVersion}} or higher. Update your Cloud Foundry instance."))
    27  			})
    28  		})
    29  
    30  		When("the Command field is empty and CurrentVersion is empty", func() {
    31  			It("returns a template without Command or CurrentVersion values", func() {
    32  				err := MinimumUAAAPIVersionNotMetError{}
    33  
    34  				Expect(err.Error()).To(Equal("This command requires UAA API version {{.MinimumVersion}} or higher. Update your Cloud Foundry instance."))
    35  			})
    36  		})
    37  	})
    38  })