Expect(ui.FailedWithUsage).To(BeTrue()) }) It("fails when not logged in", func() { runCommand("my-zone", "50") Expect(testcmd.CommandDidPassRequirements).To(BeFalse()) }) }) Context("when logged in and provided the name of a zone to create", func() { BeforeEach(func() { requirementsFactory.LoginSuccess = true }) It("fails and warns the user when the zone already exists", func() { zoneRepo.CreateZoneExists = true runCommand("my-zone", "50") Expect(ui.Outputs).To(ContainSubstrings( []string{"Creating private zone", "my-zone"}, []string{"FAILED"}, []string{"Server error", "The request is invalid"}, )) }) It("fails when the value cannot be parsed", func() { runCommand("my-zone", "fail") Expect(ui.Outputs).To(ContainSubstrings( []string{"FAILED"}, []string{"Invalid priority. A positive integer must be provided as priority"}, ))