我正在尝试lein new compojure financeiro
使用 midje 框架在 leiningen 的 compojure 模板 () 中运行测试并收到警告:
lein midje
WARNING: any? already refers to: #'clojure.core/any? in namespace: leiningen.midje, being replaced by: #'leiningen.midje/any?
nil
All checks (3) succeeded.
我的测试代码handler_test.clj
:
(ns financeiro.handler-test
(:require
; [clojure.test :refer :all]
[midje.sweet :refer :all]
[ring.mock.request :as mock]
[financeiro.handler :refer :all]))
; (deftest test-app
; (testing "main route"
; (let [response (app (mock/request :get "/"))]
; (is (= (:status response) 200))
; (is (= (:body response) "Hello World"))))
; (testing "not-found route"
; (let [response (app (mock/request :get "/invalid"))]
; (is (= (:status response) 404)))))
(facts "'Hello World' main route"
(fact "response status is 200"
(let [response (app (mock/request :get "/"))]
(:status response)=> 200))
(fact "body text is 'Hello World'"
(let [response (app (mock/request :get "/"))]
(:body response)=> "Hello World")))
(facts "not-found route"
(fact "response status is 404"
(let [response(app (mock/request :get "/invalid"))]
(:status response)=> 404)))
我的项目文件project.clj
:
(defproject financeiro "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:min-lein-version "2.0.0"
:dependencies [
[org.clojure/clojure "1.10.0"]
[compojure "1.6.1"]
[ring/ring-defaults "0.3.2"]
]
:plugins [
[lein-ring "0.12.5"]
]
:ring {
:handler financeiro.handler/app
}
:profiles {
:dev {
:dependencies [
[javax.servlet/servlet-api "2.5"]
[ring/ring-mock "0.3.2"]
[midje "1.9.8"]
]
:plugins [
[lein-midje "3.2.1"]
]
}
}
)
clojure.test
当我使用( )运行默认测试时lein test
,我没有收到警告,但是当我使用midje.sweet
( lein midje
) 运行时,我收到有关“命名空间:leiningen.midje”和“替换 #'clojure.core/any? 到 #'leiningen.midje/any?' ,我在网上寻找解决方案,但我没有找到这个特定的警告(leiningen/compojure/midje),我是 clojure 和 midje 的初学者。我现在正在学习。我可以在哪个文件中替换这个命名空间?有简单的解决方案可以消除此警告吗?或者这是框架 midje 中的一个错误?
这不会干扰测试的执行,但是每次运行测试时都看到这条消息很烦人。
注意:我也尝试过之前版本的 midje [midje "1.9.6"]
,但没有成功!