示例#1
0
文件: files_test.go 项目: QwaQ/cli
		Context("when given a valid instance", func() {
			BeforeEach(func() {
				args = []string{"app-name", "-i", "0"}
			})

			It("tells the user it is getting the files", func() {
				cmd.Execute(flagContext)
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Getting files for app app-name"},
				))
			})

			It("tries to list the files", func() {
				cmd.Execute(flagContext)
				Expect(appFilesRepo.ListFilesCallCount()).To(Equal(1))
				appGUID, instance, path := appFilesRepo.ListFilesArgsForCall(0)
				Expect(appGUID).To(Equal("app-guid"))
				Expect(instance).To(Equal(0))
				Expect(path).To(Equal("/"))
			})

			Context("when listing the files succeeds", func() {
				BeforeEach(func() {
					appFilesRepo.ListFilesReturns("files", nil)
				})

				It("tells the user OK", func() {
					cmd.Execute(flagContext)
					Expect(ui.Outputs).To(ContainSubstrings([]string{"OK"}))
				})