Пример #1
0
		}

		child2parent = make(map[layercake.ID]layercake.ID)
		fakeCake.GetStub = func(id layercake.ID) (*image.Image, error) {
			if parent, ok := child2parent[id]; ok {
				return &image.Image{ID: id.GraphID(), Parent: parent.GraphID()}, nil
			}

			return &image.Image{}, nil
		}

		fakeCake.IsLeafStub = func(id layercake.ID) (bool, error) {
			for _, p := range child2parent {
				if p == id {
					return false, nil
				}
			}

			return true, nil
		}

		fakeCake.RemoveStub = func(id layercake.ID) error {
			delete(child2parent, id)
			return nil
		}
	})

	Describe("Remove", func() {
		Context("when the layer has no parents", func() {
			BeforeEach(func() {
				fakeCake.GetReturns(&image.Image{}, nil)