|
1 | 1 | (ns compojure.api.meta-test |
2 | 2 | (:require [compojure.api.sweet :as sweet :refer :all] |
3 | | - [compojure.api.meta :as meta :refer [merge-parameters static-context routing]] |
| 3 | + [compojure.api.meta :as meta :refer [merge-parameters routing]] |
4 | 4 | [compojure.api.common :refer [merge-vector]] |
5 | 5 | [compojure.api.compojure-compat :refer [make-context]] |
6 | 6 | [clojure.data :as data] |
|
258 | 258 | :method nil, |
259 | 259 | :info (merge-parameters {:static-context? true}), |
260 | 260 | :handler |
261 | | - (static-context "/a" |
262 | | - (routing [(~'POST "/ping" [])]))}))) |
| 261 | + (let [?form (routing [(~'POST "/ping" [])])] |
| 262 | + (cc/context |
| 263 | + "/a" |
| 264 | + [:as +compojure-api-request+] |
| 265 | + ?form))}))) |
263 | 266 | (testing "dynamic context" |
264 | 267 | (is-expands (context "/a" [] :dynamic true (POST "/ping" [])) |
265 | 268 | `(map->Route |
|
277 | 280 | :handler |
278 | 281 | (cc/context "/a" |
279 | 282 | [:as +compojure-api-request+] |
280 | | - (routing [(~'POST "/ping" [])]))}))) |
281 | | - (testing "static-context" |
282 | | - (is-expands (static-context "/a" |
283 | | - (routing [(POST "/ping" [])])) |
284 | | - `(make-context |
285 | | - {:__record__ "clout.core.CompiledRoute", |
286 | | - :source "/a:__path-info", |
287 | | - :re #"/a(|/.*)", |
288 | | - :keys [:__path-info], |
289 | | - :absolute? false} |
290 | | - (let [?r ~'(routing [(POST "/ping" [])])] |
291 | | - (fn [?_] ?r)))))) |
| 283 | + (routing [(~'POST "/ping" [])]))})))) |
292 | 284 |
|
293 | 285 | (deftest is-thrown-with-msg?-test |
294 | 286 | (is-thrown-with-msg? Exception #"message" (throw (Exception. "message"))) |
|
2145 | 2137 | (is (= {:field 1 :default 1 :extra-keys 1 :extra-vals 1 :default-never 1} @times)) |
2146 | 2138 | (dorun (repeatedly 10 exercise)) |
2147 | 2139 | (is (= {:field 1 :default 1 :extra-keys 1 :extra-vals 1 :default-never 11} @times))))) |
| 2140 | + |
| 2141 | +#_ |
| 2142 | +(deftest push-context-parameters-into-endpoints-test |
| 2143 | + (macroexpand-2 |
| 2144 | + `(context "/foo" [] |
| 2145 | + :dynamic true |
| 2146 | + ))) |
0 commit comments