app = models.Application{} app.Name = "my-app" app.Guid = "my-app-guid" currentTime := time.Now() recentLogs := []*events.LogMessage{ testlogs.NewNoaaLogMessage("Log Line 1", app.Guid, "DEA", currentTime), testlogs.NewNoaaLogMessage("Log Line 2", app.Guid, "DEA", currentTime), } appLogs := []*events.LogMessage{ testlogs.NewLogMessage("Log Line 1", app.Guid, "DEA", time.Now()), } requirementsFactory.Application = app noaaRepo.RecentLogsForReturns(recentLogs, nil) noaaRepo.TailNoaaLogsForStub = func(appGuid string, onConnect func(), onMessage func(*events.LogMessage)) error { onConnect() for _, log := range appLogs { onMessage(log) } return nil } }) It("shows the recent logs when the --recent flag is provided", func() { runCommand("--recent", "my-app") Expect(requirementsFactory.ApplicationName).To(Equal("my-app")) Expect(app.Guid).To(Equal(noaaRepo.RecentLogsForArgsForCall(0)))