Skip to content

Commit

Permalink
Fix tests by loading db when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
devth committed Oct 24, 2013
1 parent c1da169 commit 5f503a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
9 changes: 4 additions & 5 deletions test/yetibot/test/campfire.clj
@@ -1,7 +1,8 @@
(ns yetibot.test.campfire
(:require [yetibot.adapters.campfire :refer :all]
[yetibot.util.format :refer :all]
[clojure.test :refer :all]))
(:require
[yetibot.chat :refer [contains-image-url-lines?]]
[yetibot.util.format :refer :all]
[clojure.test :refer :all]))

(def nested-list
[["meme generator"
Expand All @@ -17,5 +18,3 @@
(is
(contains-image-url-lines? (first formatted-list))
"it should find image urls in the string"))

(run-tests)
22 changes: 13 additions & 9 deletions test/yetibot/test/commands/alias.clj
@@ -1,17 +1,21 @@
(ns yetibot.test.commands.alias
(:require
[yetibot.db]
[yetibot.db :as db]
[yetibot.util :refer [with-fresh-db]]
[clojure.test :refer :all]
[yetibot.commands.alias :refer :all]))

(def user {:id 0})
(def user {:id "foobar"})

(deftest test-add-alias
(let [args ["a = random \\| echo hi"
"b = echo hi"
"c = random \\| echo http://foo.com?bust=%s"]]
(dorun (map #(add-alias {:user user :args %}) args))))
(defn start-db [f]
(db/start)
(f))

(use-fixtures :once start-db)

(def f (with-meta #(prn "foo") {:doc (str "foo" 2 2)}))
(meta f)
(deftest test-add-alias
(with-fresh-db
(let [args ["a = random \\| echo hi"
"b = echo hi"
"c = random \\| echo http://foo.com?bust=%s"]]
(dorun (map #(add-alias {:user user :args %}) args)))))
2 changes: 0 additions & 2 deletions test/yetibot/test/models/log.clj
Expand Up @@ -2,5 +2,3 @@
(:require
[yetibot.models.log :refer :all]
[clojure.test :refer :all]))

(select-keys args [:level :prefix :message])

0 comments on commit 5f503a8

Please sign in to comment.