github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+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("neither host nor path is specified", func() { 45 It("returns an error message referencing domain", func() { 46 err := actionerror.RouteNotFoundError{ 47 DomainName: "some-domain.com", 48 } 49 Expect(err.Error()).To(Equal("Route with domain 'some-domain.com' not found.")) 50 }) 51 }) 52 }) 53 When("Domain GUID is set", func() { 54 It("returns an error message with the GUID of the missing space", func() { 55 err := actionerror.RouteNotFoundError{ 56 DomainGUID: "some-domain-guid", 57 Host: "hostname", 58 Path: "mypath", 59 } 60 Expect(err.Error()).To(Equal("Route with host 'hostname', domain guid 'some-domain-guid', and path 'mypath' not found.")) 61 }) 62 }) 63 }) 64 })