                {:name "Some Job" :key "value"})))))
 
   (testing "if a jobs added files should change"
-    (let [path (join test-dir "add-job-config")]
-      (fs/copy-dir (io/resource "fixtures/spec-config") path)
+    (let [path (join test-dir "add-job-config")
+          repo (make-config-repo path)]
       (let [server-config (get-server-config path)
             job-config (get-job-config path server-config)
             new-job-config (atom {:name "New Job"})]

        (is (not (fs/directory? (join path "some-id")))))))

  (testing "when a job is added, changes should be reflected in the fs"
    (let [path (join test-dir "add-job-and-change-config")]
      (fs/copy-dir (io/resource "fixtures/spec-config") path)
      (let [server-config (get-server-config path)
            job-config (get-job-config path server-config)
            new-job-config (atom {:name "New Job"})]

(defn join [& args] (fs/absolute-path (apply io/file args)))
(def test-dir (join (fs/absolute-path fs/*cwd*) "test-fixtures"))

(defn read-json-file [path]
  (if (fs/file? path) (json/parse-string (slurp path) true)))

(defn make-config-repo
  ([destination] (make-config-repo destination "fixtures/spec-config"))
  ([destination source]
    (fs/copy-dir (io/resource source) destination)
    (git/git-init destination)))

(defn test-dir-fixture [fn]
  (fs/mkdir test-dir)
  (fn)
  (fs/delete-dir test-dir))

(use-fixtures :each test-dir-fixture)

