如何在Yesod规范中做待处理的规范

时间:2016-04-10 17:03:49

标签: haskell yesod hspec

我是Yesod的新手,我试图在withApp块中添加待处理的规范(目前我只是想修改Yesod生成的规范) scaffholding)。

代码如下:

appSpec :: Spec    appSpec :: withApp $ do      描述" getMyHandlerR" $ do        它" todo" $ do           未决

但是我收到以下错误消息:

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 } }

如果删除withApp一切正常。我理解withApp正在以某种方式改变预期的类型,但describeit如何具有正确的类型而pending没有?

2 个答案:

答案 0 :(得分:3)

将我的评论复制到答案:

我认为你只需要通过以下方式抛弃TestApp App参数:

it "todo" $ \_ -> pending

it "todo" $ const pending
  

添加ypending或同等产品会不值得?

对我来说听起来不错,我实际上从未亲自使用过pending这就是为什么我从未想过它。你能发送PR来获得它吗?

答案 1 :(得分:1)

这对我来说就像是最新的Yesod:

it "should x" $ do
  liftIO pending