func PathForBuild(build atc.Build) string { var path string if build.OneOff() { path, _ = Routes.CreatePathForRoute(GetJoblessBuild, rata.Params{ "build_id": fmt.Sprintf("%d", build.ID), }) } else { path, _ = Routes.CreatePathForRoute(GetBuild, rata.Params{ "pipeline_name": build.PipelineName, "job": build.JobName, "build": build.Name, }) } return path }
import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/concourse/atc" "github.com/concourse/atc/db" ) var _ = Describe("Build", func() { Describe("OneOff", func() { It("returns true if there is no JobName", func() { build := atc.Build{ JobName: "", } Expect(build.OneOff()).To(BeTrue()) }) It("returns false if there is a JobName", func() { build := atc.Build{ JobName: "something", } Expect(build.OneOff()).To(BeFalse()) }) }) Describe("IsRunning", func() { It("returns true if the build is pending", func() { build := atc.Build{ Status: string(atc.StatusPending), }