Context("when the group with the given name exists", func() { BeforeEach(func() { securityGroupRepo.ReadReturns(models.SecurityGroup{ SecurityGroupFields: models.SecurityGroupFields{ Name: "my-group", Guid: "group-guid", }, }, nil) }) Context("delete a security group", func() { It("when passed the -f flag", func() { runCommand("-f", "my-group") Expect(securityGroupRepo.ReadArgsForCall(0)).To(Equal("my-group")) Expect(securityGroupRepo.DeleteArgsForCall(0)).To(Equal("group-guid")) Expect(ui.Prompts).To(BeEmpty()) }) It("should prompt user when -f flag is not present", func() { ui.Inputs = []string{"y"} runCommand("my-group") Expect(securityGroupRepo.ReadArgsForCall(0)).To(Equal("my-group")) Expect(securityGroupRepo.DeleteArgsForCall(0)).To(Equal("group-guid")) Expect(ui.Prompts).To(ContainSubstrings( []string{"Really delete the security group", "my-group"}, )) })