code.cloudfoundry.org/cli@v7.1.0+incompatible/actor/actionerror/route_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("RouteNotFoundError", func() {
    10  
    11  	Describe("Error", func() {
    12  		When("DomainName is set", func() {
    13  			When("the host and path are specified", func() {
    14  				It("returns an error message referencing domain, host and path", func() {
    15  					err := actionerror.RouteNotFoundError{
    16  						DomainName: "some-domain.com",
    17  						Path:       "mypath",
    18  						Host:       "hostname",
    19  					}
    20  					Expect(err.Error()).To(Equal("Route with host 'hostname', domain 'some-domain.com', and path 'mypath' not found."))
    21  				})
    22  			})
    23  
    24  			When("the host is specified", func() {
    25  				It("returns an error message referencing domain and host", func() {
    26  					err := actionerror.RouteNotFoundError{
    27  						DomainName: "some-domain.com",
    28  						Host:       "hostname",
    29  					}
    30  					Expect(err.Error()).To(Equal("Route with host 'hostname' and domain 'some-domain.com' not found."))
    31  				})
    32  			})
    33  
    34  			When("the path is specified", func() {
    35  				It("returns an error message referencing domain and path", func() {
    36  					err := actionerror.RouteNotFoundError{
    37  						DomainName: "some-domain.com",
    38  						Path:       "mypath",
    39  					}
    40  					Expect(err.Error()).To(Equal("Route with domain 'some-domain.com' and path 'mypath' not found."))
    41  				})
    42  			})
    43  
    44  			When("the port is specified", func() {
    45  				It("returns an error message referencing domain and port", func() {
    46  					err := actionerror.RouteNotFoundError{
    47  						DomainName: "some-domain.com",
    48  						Port:       1052,
    49  					}
    50  					Expect(err.Error()).To(Equal("Route with domain 'some-domain.com' and port 1052 not found."))
    51  				})
    52  			})
    53  
    54  			When("neither host nor path is specified", func() {
    55  				It("returns an error message referencing domain", func() {
    56  					err := actionerror.RouteNotFoundError{
    57  						DomainName: "some-domain.com",
    58  					}
    59  					Expect(err.Error()).To(Equal("Route with domain 'some-domain.com' not found."))
    60  				})
    61  			})
    62  		})
    63  		When("Domain GUID is set", func() {
    64  			It("returns an error message with the GUID of the missing space", func() {
    65  				err := actionerror.RouteNotFoundError{
    66  					DomainGUID: "some-domain-guid",
    67  					Host:       "hostname",
    68  					Path:       "mypath",
    69  				}
    70  				Expect(err.Error()).To(Equal("Route with host 'hostname', domain guid 'some-domain-guid', and path 'mypath' not found."))
    71  			})
    72  		})
    73  	})
    74  })