args := []string{ "--instances=10", "cool-web-app", "superfun/app", "--", "/start-me-please", } doneChan := test_helpers.AsyncExecuteCommandWithArgs(createCommand, args) Eventually(outputBuffer).Should(test_helpers.SayLine("Creating App: cool-web-app")) Expect(fakeTailedLogsOutputter.OutputTailedLogsCallCount()).To(Equal(1)) Expect(fakeTailedLogsOutputter.OutputTailedLogsArgsForCall(0)).To(Equal("cool-web-app")) Expect(fakeAppExaminer.RunningAppInstancesInfoCallCount()).To(Equal(1)) Expect(fakeAppExaminer.RunningAppInstancesInfoArgsForCall(0)).To(Equal("cool-web-app")) fakeClock.IncrementBySeconds(1) Expect(fakeTailedLogsOutputter.StopOutputtingCallCount()).To(Equal(0)) fakeAppExaminer.RunningAppInstancesInfoReturns(9, false, nil) fakeClock.IncrementBySeconds(1) Expect(doneChan).ShouldNot(BeClosed()) Expect(fakeTailedLogsOutputter.StopOutputtingCallCount()).To(Equal(0)) fakeAppExaminer.RunningAppInstancesInfoReturns(10, false, nil) fakeClock.IncrementBySeconds(1) Eventually(doneChan).Should(BeClosed()) Expect(outputBuffer).To(test_helpers.SayNewLine())