B: fakeConfigSourceB, } }) JustBeforeEach(func() { fetchedConfig, fetchErr = configSource.FetchConfig(repo) }) Context("when fetching via A succeeds", func() { var configA = atc.TaskConfig{ Image: "some-image", Params: map[string]string{"PARAM": "A"}, } BeforeEach(func() { fakeConfigSourceA.FetchConfigReturns(configA, nil) }) Context("and fetching via B succeeds", func() { var configB = atc.TaskConfig{ Params: map[string]string{"PARAM": "B"}, } BeforeEach(func() { fakeConfigSourceB.FetchConfigReturns(configB, nil) }) It("fetches via the input source", func() { Ω(fakeConfigSourceA.FetchConfigArgsForCall(0)).Should(Equal(repo)) Ω(fakeConfigSourceB.FetchConfigArgsForCall(0)).Should(Equal(repo)) })
Context("when the getting the config works", func() { var fetchedConfig atc.TaskConfig BeforeEach(func() { fetchedConfig = atc.TaskConfig{ Platform: "some-platform", Tags: []string{"config", "tags"}, Image: "some-image", Params: map[string]string{"SOME": "params"}, Run: atc.TaskRunConfig{ Path: "ls", Args: []string{"some", "args"}, }, } configSource.FetchConfigReturns(fetchedConfig, nil) }) Context("when creating the task's container works", func() { var ( fakeContainer *wfakes.FakeContainer fakeProcess *gfakes.FakeProcess ) BeforeEach(func() { fakeContainer = new(wfakes.FakeContainer) fakeContainer.HandleReturns("some-handle") fakeWorkerClient.CreateContainerReturns(fakeContainer, nil) fakeProcess = new(gfakes.FakeProcess) fakeProcess.IDReturns(42)