    :value 1000M})
 
 (deftest purchase-a-commodity
-  (let [context (serialization/realize storage-spec purchase-context)
-        ira (find-account context "IRA")
-        commodity (find-commodity context "AAPL")
-        result (trading/buy storage-spec (purchase-attributes context))
+  (let [context (serialization/realize (env :db) purchase-context)
+        ira (find-account context "IRA")
+        commodity (find-commodity context "AAPL")
+        result (trading/buy (env :db) (purchase-attributes context))
         apple-account (->> {:commodity-id (:id commodity)
                             :entity-id (-> context :entities first :id)}
-                           (accounts/search storage-spec)
+                           (accounts/search (env :db))
                            first)
         expected-transaction {:entity-id (-> context :entities first :id)
                               :transaction-date (t/local-date 2016 1 2)

    (is (= expected-commodity-account
           actual-commodity-account)
        "The commodity account is created")
    (is ((->> ira (accounts/reload storage-spec) :tags) :trading)
        "The specified account is tagged as a trading account")))

(deftest purchase-a-commodity-with-string-values
 (let [context (serialization/realize storage-spec purchase-context)
        ira (find-account context "IRA")
        commodity (find-commodity context "AAPL")
        result (trading/buy storage-spec (-> context
                                             purchase-attributes
                                             (update-in [:account-id] str)
                                             (update-in [:commodity-id] str)

    (is (= expected gains-items) "The capital gains account is credited the correct amount")))

(deftest selling-a-commodity-for-a-profit-before-1-year-credits-short-term-capital-gains
  (let [context (serialization/realize (env :db) sale-context)
        st-capital-gains (find-account context "Short-term Capital Gains")
        _ (trading/sell (env :db) (-> context
                                         sale-attributes
                                         (assoc :shares 25M
                                                :value 375M
