 
 (use-fixtures :each log-fixture)
 
-(defn intersect-keys= [expected actual]
-  (let [keys-to-compare (keys expected)]
-    (= expected (select-keys actual keys-to-compare))))
+(defn diff-with-first-nil? [expected actual]
+  (let [diff (first (data/diff expected actual))]
+    (when diff (pprint {:diff diff}))
+    (= nil (first (data/diff expected actual)))))
 
 (defn make-uuid []
   (java.util.UUID/randomUUID))

  (:require [foosball.models.db :refer :all]
            [com.stuartsierra.component :as c]
            [foosball.models.domains :as d]
            [clojure.test :refer :all]
            [taoensso.timbre :as t]))

(defn memory-db []
  (c/start

                     :id id}] (d/get-players db))))

          (testing "we can get the player be his openid"
            (is (diff-with-first-nil? {:playername name
                                       :playerid id} (d/get-player-with-given-openid db openid))))

          (testing "we can inactivate him,"
            (is (not= nil (d/deactivate-player! db id)))
            (testing "then he is inactive"
              (is (diff-with-first-nil? {:active false} (first (d/get-players db))))))

          (testing "we can reactivate him,"
            (is (not= nil (d/activate-player! db id)))
            (testing "then he is active again"
              (is (diff-with-first-nil? {:active true} (first (d/get-players db))))))
          (testing "we can rename our player,"
            (let [new-name "jeffrey"]
              (is (not= nil (d/rename-player! db id new-name)))
