コード例 #1
0
				requestBody = &models.ConvergeTasksRequest{
					KickTaskDuration:            kickTaskDuration,
					ExpirePendingTaskDuration:   expirePendingTaskDuration,
					ExpireCompletedTaskDuration: expireCompletedTaskDuration,
				}
			})

			JustBeforeEach(func() {
				request := newTestRequest(requestBody)
				handler.ConvergeTasks(responseRecorder, request)
			})

			It("calls ConvergeTasks", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusOK))
				Expect(fakeTaskDB.ConvergeTasksCallCount()).To(Equal(1))
				taskLogger, actualKickDuration, actualPendingDuration, actualCompletedDuration := fakeTaskDB.ConvergeTasksArgsForCall(0)
				Expect(taskLogger.SessionName()).To(ContainSubstring("converge-tasks"))
				Expect(actualKickDuration).To(BeEquivalentTo(kickTaskDuration))
				Expect(actualPendingDuration).To(BeEquivalentTo(expirePendingTaskDuration))
				Expect(actualCompletedDuration).To(BeEquivalentTo(expireCompletedTaskDuration))

				Expect(responseRecorder.Code).To(Equal(http.StatusOK))
				response := &models.TaskLifecycleResponse{}
				err := response.Unmarshal(responseRecorder.Body.Bytes())
				Expect(err).NotTo(HaveOccurred())

				Expect(response.Error).To(BeNil())
			})
		})
	})
})