【问题标题】:Midje stub method doesn't workMidje 存根方法不起作用
【发布时间】: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模板生成了一个项目,把代码扔进去了。
  • 是的,对于新生成的项目,它可以工作。现在我也为我的项目找到了解决方案。谢谢!

标签: clojure stubbing midje


【解决方案1】:

问题在于project.clj 文件中的这一行:

:jvm-opts ^:replace ["-Dclojure.compiler.direct-linking=true"]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-22
    • 2019-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-15
    • 2017-12-03
    • 1970-01-01
    相关资源
    最近更新 更多