func restartGarden(client *runner.RunningGarden, argv ...string) { Expect(client.Ping()).To(Succeed(), "tried to restart garden while it was not running") Expect(client.Stop()).To(Succeed()) client = startGarden(argv...) }
JustBeforeEach(func() { client = startGarden(args...) }) Describe("--iptables-bin flag", func() { Context("when the path is valid", func() { BeforeEach(func() { args = append(args, "--iptables-bin", "/sbin/iptables") }) AfterEach(func() { Expect(client.DestroyAndStop()).To(Succeed()) }) It("should succeed to start the server", func() { Expect(client.Ping()).To(Succeed()) }) }) Context("when the path is invalid", func() { BeforeEach(func() { args = append(args, "--iptables-bin", "/path/to/iptables/bin") }) It("should fail to start the server", func() { Expect(client.Ping()).To(HaveOccurred()) }) }) Context("when the path is valid but it's not iptables", func() { BeforeEach(func() {