From 747514b53ddd06d5d37d096c1cb313cfe620d7d4 Mon Sep 17 00:00:00 2001 From: Emmanouil Kiagias Date: Fri, 19 Jan 2018 17:42:37 +0000 Subject: [PATCH] Add tests for When/Specify Signed-off-by: Will Martin --- .../progress_fixture/progress_fixture_test.go | 14 ++++++++++++-- integration/progress_test.go | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/integration/_fixtures/progress_fixture/progress_fixture_test.go b/integration/_fixtures/progress_fixture/progress_fixture_test.go index 1e0aa7950..b7f26c25b 100644 --- a/integration/_fixtures/progress_fixture/progress_fixture_test.go +++ b/integration/_fixtures/progress_fixture/progress_fixture_test.go @@ -32,8 +32,18 @@ var _ = Describe("ProgressFixture", func() { fmt.Fprintln(GinkgoWriter, ">inner after<") }) - It("should emit progress as it goes", func() { - fmt.Fprintln(GinkgoWriter, ">it<") + When("Inner When", func() { + BeforeEach(func() { + fmt.Fprintln(GinkgoWriter, ">inner before<") + }) + + It("should emit progress as it goes", func() { + fmt.Fprintln(GinkgoWriter, ">it<") + }) }) }) + + Specify("should emit progress as it goes", func() { + fmt.Fprintln(GinkgoWriter, ">specify<") + }) }) diff --git a/integration/progress_test.go b/integration/progress_test.go index 8589c338a..2bd574473 100644 --- a/integration/progress_test.go +++ b/integration/progress_test.go @@ -50,12 +50,17 @@ var _ = Describe("Emitting progress", func() { }) It("should emit progress (by writing to the GinkgoWriter)", func() { + // First spec + Ω(session).Should(gbytes.Say(`\[BeforeEach\] ProgressFixture`)) Ω(session).Should(gbytes.Say(`>outer before<`)) Ω(session).Should(gbytes.Say(`\[BeforeEach\] Inner Context`)) Ω(session).Should(gbytes.Say(`>inner before<`)) + Ω(session).Should(gbytes.Say(`\[BeforeEach\] when Inner When`)) + Ω(session).Should(gbytes.Say(`>inner before<`)) + Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] ProgressFixture`)) Ω(session).Should(gbytes.Say(`>outer just before<`)) @@ -70,6 +75,20 @@ var _ = Describe("Emitting progress", func() { Ω(session).Should(gbytes.Say(`\[AfterEach\] ProgressFixture`)) Ω(session).Should(gbytes.Say(`>outer after<`)) + + // Second spec + + Ω(session).Should(gbytes.Say(`\[BeforeEach\] ProgressFixture`)) + Ω(session).Should(gbytes.Say(`>outer before<`)) + + Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] ProgressFixture`)) + Ω(session).Should(gbytes.Say(`>outer just before<`)) + + Ω(session).Should(gbytes.Say(`\[It\] should emit progress as it goes`)) + Ω(session).Should(gbytes.Say(`>specify<`)) + + Ω(session).Should(gbytes.Say(`\[AfterEach\] ProgressFixture`)) + Ω(session).Should(gbytes.Say(`>outer after<`)) }) }) })