Example #1
0
	"errors"
	"time"

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

	"github.com/concourse/atc"
	"github.com/concourse/atc/db"
	"github.com/concourse/atc/web/group"

	. "github.com/concourse/atc/web/getjob"
	"github.com/concourse/atc/web/getjob/fakes"
)

var _ = Describe("FetchTemplateData", func() {
	var fakeDB *fakes.FakeJobDB

	BeforeEach(func() {
		fakeDB = new(fakes.FakeJobDB)
	})

	Context("when the config database returns an error", func() {
		BeforeEach(func() {
			fakeDB.GetConfigReturns(atc.Config{}, db.ConfigVersion(1), errors.New("disaster"))
		})

		It("returns an error if the config could not be loaded", func() {
			_, err := FetchTemplateData(fakeDB, "job-name")
			Ω(err).Should(HaveOccurred())
		})
	})
Example #2
0
import (
	"errors"

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

	"github.com/concourse/atc"
	"github.com/concourse/atc/db"
	"github.com/concourse/atc/web/group"

	. "github.com/concourse/atc/web/getjob"
	"github.com/concourse/atc/web/getjob/fakes"
)

var _ = Describe("FetchTemplateData", func() {
	var fakeDB *fakes.FakeJobDB

	BeforeEach(func() {
		fakeDB = new(fakes.FakeJobDB)
	})

	Context("when the config database returns an error", func() {
		BeforeEach(func() {
			fakeDB.GetConfigReturns(atc.Config{}, db.ConfigVersion(1), errors.New("disaster"))
		})

		It("returns an error if the config could not be loaded", func() {
			_, err := FetchTemplateData(fakeDB, "job-name")
			Ω(err).Should(HaveOccurred())
		})
	})