github.com/Thanhphan1147/cloudfoundry-cli@v7.1.0+incompatible/actor/actionerror/space_not_found_error_test.go (about)

     1  package actionerror_test
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/actor/actionerror"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  )
     8  
     9  var _ = Describe("SpaceNotFoundError", func() {
    10  	Describe("Error", func() {
    11  		When("the name is specified", func() {
    12  			It("returns an error message with the name of the missing space", func() {
    13  				err := actionerror.SpaceNotFoundError{
    14  					Name: "some-space",
    15  				}
    16  				Expect(err.Error()).To(Equal("Space 'some-space' not found."))
    17  			})
    18  		})
    19  
    20  		When("the name is not specified, but the GUID is specified", func() {
    21  			It("returns an error message with the GUID of the missing space", func() {
    22  				err := actionerror.SpaceNotFoundError{
    23  					GUID: "some-space-guid",
    24  				}
    25  				Expect(err.Error()).To(Equal("Space with GUID 'some-space-guid' not found."))
    26  			})
    27  		})
    28  
    29  		When("neither the name nor the GUID is specified", func() {
    30  			It("returns a generic error message for the missing space", func() {
    31  				err := actionerror.SpaceNotFoundError{}
    32  				Expect(err.Error()).To(Equal("Space '' not found."))
    33  			})
    34  		})
    35  	})
    36  })