Skip to content

Commit

Permalink
Add tests for When/Specify
Browse files Browse the repository at this point in the history
Signed-off-by: Will Martin <wmartin@pivotal.io>
  • Loading branch information
alamages authored and williammartin committed Jan 19, 2018
1 parent 7484dad commit 747514b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
14 changes: 12 additions & 2 deletions integration/_fixtures/progress_fixture/progress_fixture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<")
})
})
19 changes: 19 additions & 0 deletions integration/progress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<`))

Expand All @@ -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<`))
})
})
})

0 comments on commit 747514b

Please sign in to comment.