BeforeEach(func() { threshold = 1234 fakeCake = new(fake_cake.FakeCake) logger = lagertest.NewTestLogger("test") }) Context("when there are no layers in the graph", func() { It("is not exceeded", func() { threshold := cleaner.NewThreshold(threshold) Expect(threshold.Exceeded(logger, fakeCake)).To(BeFalse()) }) }) Context("when the limit is -1", func() { It("always returns false", func() { fakeCake.AllReturns([]*image.Image{{Size: 9999999}}) threshold := cleaner.NewThreshold(-1) Expect(threshold.Exceeded(logger, fakeCake)).To(BeFalse()) }) }) Context("when there is just one layer in the graph", func() { Context("and it exceeds the threshold", func() { BeforeEach(func() { fakeCake.AllReturns( []*image.Image{ &image.Image{ Size: 1235, }, }, )