예제 #1
0
		tmp   string
		bndle goci.Bndl
	)

	BeforeEach(func() {
		var err error
		tmp, err = ioutil.TempDir("", "gocitest")
		Expect(err).NotTo(HaveOccurred())

		bndle = goci.Bndl{
			Spec: specs.Spec{
				Version: "abcd",
			},
		}

		Expect(bndle.Save(tmp)).To(Succeed())
	})

	AfterEach(func() {
		Expect(os.RemoveAll(tmp)).To(Succeed())
	})

	Describe("Saving", func() {
		It("serializes the spec to spec.json", func() {
			var configJson map[string]interface{}
			Expect(json.NewDecoder(mustOpen(path.Join(tmp, "config.json"))).Decode(&configJson)).To(Succeed())

			Expect(configJson).To(HaveKeyWithValue("ociVersion", Equal("abcd")))
		})

		Context("when saving fails", func() {