Open
Description
Given I have some typical yesod-test scaffolding like this
withApp :: SpecWith (TestApp App) -> Spec
withApp = around (bracket beforeEach afterEach) . aroundWith (. fst)
where
beforeEach :: IO (TestApp App, ())
beforeEach = do
app <- makeFoundation ":memory:"
pure ((app, defaultMiddlewaresNoLogging), ())
afterEach :: (TestApp App, ()) -> IO ()
afterEach ((app, _), _) = shutdownApp app
…how do I run yesod tests with hspec-hedgehog?
I'd like to write something like this (which, of course, doesn't work).
spec :: Spec
spec = withApp $ do
it "Displays the param" $ hedgehog $ do
-- for any given number…
xs <- forAll $ Gen.int (Range.linear 0 1000)
-- navigate to some page with that number
get $ SomeRouteR xs
-- assert that the page renders the number
htmlAnyContain "p" xs
Metadata
Assignees
Labels
No labels