. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/cloudfoundry-incubator/bbs/models"
	"github.com/cloudfoundry-incubator/ltc/task_examiner"
	"github.com/cloudfoundry-incubator/ltc/task_examiner/fake_task_examiner"
	"github.com/cloudfoundry-incubator/ltc/task_runner"
	"github.com/cloudfoundry-incubator/receptor"
	"github.com/cloudfoundry-incubator/receptor/fake_receptor"
	"github.com/pivotal-golang/clock/fakeclock"
)

var _ = Describe("TaskRunner", func() {
	var (
		fakeReceptorClient *fake_receptor.FakeClient
		taskRunner         task_runner.TaskRunner
		fakeTaskExaminer   *fake_task_examiner.FakeTaskExaminer
		fakeClock          *fakeclock.FakeClock
	)

	BeforeEach(func() {
		fakeReceptorClient = &fake_receptor.FakeClient{}
		fakeTaskExaminer = &fake_task_examiner.FakeTaskExaminer{}
		location, err := time.LoadLocation("Africa/Djibouti")
		Expect(err).NotTo(HaveOccurred())
		fakeClock = fakeclock.NewFakeClock(time.Date(2012, time.February, 29, 6, 45, 30, 820, location))
		taskRunner = task_runner.New(fakeReceptorClient, fakeTaskExaminer, fakeClock)
	})

	Describe("CreateTask", func() {
		var (
			action             *models.Action