haskellyesodhspec

How to do pending spec inside Yesod specs


I'm new to Yesod and I'm trying to add a pending spec within a withApp block (at the moment I'm just trying to modify the spec generated by the Yesod scaffholding).

the code looks like :

appSpec :: Spec appSpec :: withApp $ do describe "getMyHandlerR" $ do it "todo" $ do pending

But I got the following error message :

Couldn't match type ‘(App, wai-3.2.0:Network.Wai.Middleware)’
               with ‘()’
Expected type: SpecWith (TestApp App)
  Actual type: SpecWith (Arg Expectation)
In a stmt of a 'do' block: it "todo" $ do { pending }
In the second argument of ‘($)’, namely
  ‘do { it "todo" $ do { pending } }’
In a stmt of a 'do' block:
  describe "upload a file without error"
  $ do { it "todo" $ do { pending } }

If I remove the withApp everything works. I understand withApp is changing somehow the expected type but how come describe and it have the correct type whereas pending doesn't ?


Solution

  • Copying my comment to an answer:

    I think you just need to throw away the TestApp App argument via:

    it "todo" $ \_ -> pending
    

    or

    it "todo" $ const pending
    

    Wouldn't it be worth doing adding a ypending or equivalent?

    Sounds like a good idea to me, I've actually never personally used pending which is why I'd never thought of it. Would you be able to send a PR to get that included?