-
Notifications
You must be signed in to change notification settings - Fork 374
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
yesod-test
refactor/split into yesod-hspec
with hooks!
#1763
base: master
Are you sure you want to change the base?
Conversation
yesod-test
refactor/split into yesod-hspec
with hooks!
yesod-hspec/test/main.hs
Outdated
describe "hooks" $ yesodSpec app $ do | ||
ybefore_ (get ("/" :: Text)) $ do | ||
yit "works" $ do | ||
statusIs 200 | ||
ybefore_ (post ("/cookie/foo" :: Text)) $ do | ||
yit "works again" $ do | ||
statusIs 303 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the exciting thing. Now if you want a bunch of tests that share some setup, you can get it. This makes it much easier to write small tests that make small assertions and reduce code duplication.
hmm now that i have figured this out, i am going to try and get it into a more minimal change so it will hopefully break fewer things |
So #1749 had me try an d implement hooks, which didn't work, because we go from
TestApp site -> YesodExampleData site
in the various example-runners and immediately throw that info away. So there is not a way to get hook behavior with the current implementation of theyesod-test
.I refactored it and made
yesod-hspec
in this repository, which follows thehspec
pattern a bit more closely and allows hooks.Not sure if this should be a huge breaking change to
yesod-test
or an alternative.Before submitting your PR, check that you've:
@since
declarations to the Haddocks for new, public APIsAfter submitting your PR: