From 753d4bec2214ddc51f4d45cda260a5a440cd794c Mon Sep 17 00:00:00 2001 From: Cam Saul <cam@geotip.com> Date: Mon, 9 Mar 2015 18:37:18 -0700 Subject: [PATCH] better forced lazy loading for test data --- test/metabase/test_data.clj | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/metabase/test_data.clj b/test/metabase/test_data.clj index 82eba96d058..d42af92e19b 100644 --- a/test/metabase/test_data.clj +++ b/test/metabase/test_data.clj @@ -164,12 +164,12 @@ :private true} tables (delay + @test-db ; force lazy evaluation of Test DB (binding [*log-db-calls* false] - (letfn [(table-kw->table-id [table-kw] - (->> (-> table-kw name .toUpperCase) - (sel :one [Table :id] :db_id @db-id :name) - :id))] - (map-table-kws table-kw->table-id))))) + (map-table-kws (fn [table-kw] + (->> (-> table-kw name .toUpperCase) + (sel :one [Table :id] :db_id @db-id :name) + :id)))))) (def ^{:doc "A map of Table name keywords -> map of Field name keywords -> Field IDs. @@ -180,16 +180,16 @@ :private true} table-fields (delay + @test-db ; force lazy evaluation of Test DB (binding [*log-db-calls* false] - (letfn [(table-kw->fields [table-kw] - (->> (sel :many [Field :name :id] :table_id (@tables table-kw)) - (map (fn [{:keys [^String name id]}] - {:pre [(string? name) - (integer? id) - (not (zero? id))]} - {(keyword (.toLowerCase name)) id})) - (reduce merge {})))] - (map-table-kws table-kw->fields))))) + (map-table-kws (fn [table-kw] + (->> (sel :many [Field :name :id] :table_id (@tables table-kw)) + (map (fn [{:keys [^String name id]}] + {:pre [(string? name) + (integer? id) + (not (zero? id))]} + {(keyword (.toLowerCase name)) id})) + (reduce merge {}))))))) ;; ## Users -- GitLab