Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JustAfterEach #484

Merged
merged 4 commits into from
Nov 5, 2018
Merged

Add JustAfterEach #484

merged 4 commits into from
Nov 5, 2018

Conversation

lwr20
Copy link
Contributor

@lwr20 lwr20 commented Jun 5, 2018

Fixes issue #483

@nodo
Copy link
Collaborator

nodo commented Jul 12, 2018

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
Copy link
Contributor Author

lwr20 commented Jul 12, 2018

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
Copy link
Collaborator

nodo commented Jul 13, 2018

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
Sponsor Collaborator

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

@lwr20
Copy link
Contributor Author

lwr20 commented Nov 5, 2018

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
Copy link
Contributor Author

lwr20 commented Nov 5, 2018

Docs update in #533

@williammartin williammartin merged commit 0d4f080 into onsi:master Nov 5, 2018
@williammartin
Copy link
Sponsor Collaborator

williammartin commented Nov 5, 2018

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.

None yet

3 participants