【发布时间】:2016-06-10 22:44:29
【问题描述】:
我正在尝试这样做:
(defn pilot-ready [args] [2])
(defn ready []
(pilot-ready ["hello"]))
(facts
(ready) => [1]
(provided (pilot-ready ["hello"]) => [1]))
(against-background
[(pilot-ready ["hello"]) => [1]]
(fact
(ready) => [1]))
这应该做什么,是存根 Pilot Ready 方法,并使其返回 [1] 作为参数 ["hello"]
第一个事实失败了:
FAIL at (innkeeper_paths_client_facts.clj:53)
These calls were not made the right number of times:
(pilot-ready ["hello"]) [expected at least once, actually never called]
FAIL at (innkeeper_paths_client_facts.clj:52)
Expected: [1]
Actual: [2]
Diffs: in [0] expected 1, was 2
=> false
第二个有:
FAIL at (innkeeper_paths_client_facts.clj:58)
Expected: [1]
Actual: [2]
Diffs: in [0] expected 1, was 2
=> false
谁能帮我弄清楚我做错了什么?
【问题讨论】:
-
你的例子对我有用。刚刚用midje模板生成了一个项目,把代码扔进去了。
-
是的,对于新生成的项目,它可以工作。现在我也为我的项目找到了解决方案。谢谢!