})

		Context("when the response builder does not return an error", func() {
			var backendResponseJson []byte

			BeforeEach(func() {
				backendResponse = cc_messages.StagingResponseForCC{}

				var err error
				backendResponseJson, err = json.Marshal(backendResponse)
				Expect(err).NotTo(HaveOccurred())
			})

			It("posts the response builder's result to CC", func() {
				Expect(fakeCCClient.StagingCompleteCallCount()).To(Equal(1))
				guid, payload, _ := fakeCCClient.StagingCompleteArgsForCall(0)
				Expect(guid).To(Equal("the-task-guid"))
				Expect(payload).To(Equal(backendResponseJson))
			})

			Context("when the CC request succeeds", func() {
				It("increments the staging success counter", func() {
					Expect(metricSender.GetCounter("StagingRequestsSucceeded")).To(BeEquivalentTo(1))
				})

				It("emits the time it took to stage succesfully", func() {
					Expect(metricSender.GetValue("StagingRequestSucceededDuration")).To(Equal(fake.Metric{
						Value: float64(stagingDurationNano),
						Unit:  "nanos",
					}))