Skip to content

Add JustAfterEach#484

Merged
williammartin merged 4 commits into
onsi:masterfrom
lwr20:master
Nov 5, 2018
Merged

Add JustAfterEach#484
williammartin merged 4 commits into
onsi:masterfrom
lwr20:master

Conversation

@lwr20

@lwr20 lwr20 commented Jun 5, 2018

Copy link
Copy Markdown
Contributor

Fixes issue #483

@nodo

nodo commented Jul 12, 2018

Copy link
Copy Markdown
Collaborator

Hey @lwr20

Thanks for your PR and apologies for the late reply. It looks good to me and I am happy to merge it. Would you be able to resolve the conflict in the .gitignore?

Also, could you add a paragraph to the docs explaining JustAfterEach? You can follow the style of JustBeforeEach (see here).

@lwr20

lwr20 commented Jul 12, 2018

Copy link
Copy Markdown
Contributor Author

That's great news, thanks! I'll find some time to do those things next week.

Dumb question time now - where would I find the docs to add that paragraph?

@nodo

nodo commented Jul 13, 2018

Copy link
Copy Markdown
Collaborator

To add the docs you should open a PR to the gh-pages branch:

git checkout gh-pages
<make changes>

# If you want to check the docs locally
bundle install 
bundle exec jekyll serve
# ... open the browser and check your changes ...

Feel free to ping me if you have doubts and thanks for your help 👍

@williammartin

Copy link
Copy Markdown
Collaborator

@lwr20 @nodo Did we ever get docs for this? I'd like to merge.

@lwr20

lwr20 commented Nov 5, 2018

Copy link
Copy Markdown
Contributor Author

You haven't received docs for this yet and that's my fault. I'll try to knock something up today.

@lwr20 lwr20 mentioned this pull request Nov 5, 2018
@lwr20

lwr20 commented Nov 5, 2018

Copy link
Copy Markdown
Contributor Author

Docs update in #533

@williammartin williammartin merged commit 0d4f080 into onsi:master Nov 5, 2018
@williammartin

williammartin commented Nov 5, 2018

Copy link
Copy Markdown
Collaborator

I had a play around with this just now, the behaviour is intuitive if you know JustBeforeEach, but here's the sample I used anyway:

var _ = Describe("Testing Just After Eaches", func() {

	BeforeEach(func() {
		fmt.Println("BeforeEach")
	})

	JustBeforeEach(func() {
		fmt.Println("JustBeforeEach")
	})

	When("in a context", func() {

		BeforeEach(func() {
			fmt.Println("NestedBeforeEach")
		})

		JustBeforeEach(func() {
			fmt.Println("NestedJustBeforeEach")
		})

		It("does more stuff", func() {
			fmt.Println("It")
		})

		JustAfterEach(func() {
			fmt.Println("NestedJustAfterEach")
		})

		AfterEach(func() {
			fmt.Println("NestedAfterEach")
		})

	})

	JustAfterEach(func() {
		fmt.Println("JustAfterEach")
	})

	AfterEach(func() {
		fmt.Println("AfterEach")
	})
})

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants