github.com/cloudfoundry/cli@v7.1.0+incompatible/actor/actionerror/duplicate_service_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("Duplicate Service Error", func() {
    10  	It("returns the right error message", func() {
    11  		err := actionerror.DuplicateServiceError{
    12  			Name: "some-service-name",
    13  		}
    14  		Expect(err.Error()).To(
    15  			Equal("Service 'some-service-name' is provided by multiple service brokers. Specify a broker by using the '-b' flag."))
    16  	})
    17  
    18  	When("service broker names are specified", func() {
    19  		It("returns the right error message", func() {
    20  			err := actionerror.DuplicateServiceError{
    21  				Name:           "some-service-name",
    22  				ServiceBrokers: []string{"a-service-broker", "another-service-broker"},
    23  			}
    24  			Expect(err.Error()).To(
    25  				Equal("Service 'some-service-name' is provided by multiple service brokers.\n" +
    26  					"Specify a broker from available brokers 'a-service-broker', 'another-service-broker' by using the '-b' flag."))
    27  		})
    28  	})
    29  })