Skip to content

No such var: jdbc/with-transaction #12

Description

@alexanderursu99

After following this step of the guestbook guide, I get the following when running lein test.

$ lein test
2020-07-14 20:42:51,454 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider 
Syntax error compiling at (guestbook/test/db/core.clj:20:3).
No such var: jdbc/with-transaction

Full report at:
/tmp/clojure-16884464781834444921.edn
Tests failed.

Sample code in the guide has the namespace set like so:

(ns guestbook.test.db.core
  (:require
   [guestbook.db.core :refer [*db*] :as db]
   [luminus-migrations.core :as migrations]
   [clojure.test :refer :all]
   [clojure.java.jdbc :as jdbc]
   [guestbook.config :refer [env]]
   [mount.core :as mount]))

when initially after creating the project with lein new luminus guestbook +h2 +immutant it was originally:

(ns guestbook.test.db.core
  (:require
   [guestbook.db.core :refer [*db*] :as db]
   [java-time.pre-java8]
   [luminus-migrations.core :as migrations]
   [clojure.test :refer :all]
   [next.jdbc :as jdbc]
   [guestbook.config :refer [env]]
   [mount.core :as mount]))

Found that swapping out [clojure.java.jdbc :as jdbc] for [next.jdbc :as jdbc] and leaving out [java-time.pre-java8] seemed to work.

Only issue after that is lein test seems to use guestbook_dev.db instead of guestbook_test.db, where entries to the db during the test are persisted and can be seen afterwards on the webpage when doing a lein run.

Also curious why the db files are not included in the .gitignore.

generated using Luminus version "3.78"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions