Skip to content
Browse files

Make helper content centric.

  • Loading branch information...
1 parent 9a7fea2 commit 4e898e512afdbbc047d98e526946a6ac87fc5028 @jeluard jeluard committed May 12, 2013
Showing with 5 additions and 6 deletions.
  1. +3 −3 src/tentacles/gists.clj
  2. +2 −3 test/tentacles/gists_test.clj
6 src/tentacles/gists.clj
@@ -43,11 +43,11 @@
(assoc options
:files (into {} (for [[k v] files] [k {:content v}]))))
-(defn map-file
- "Gist files as a human friendly map"
+(defn file-contents
+ "Extract a file->content map from a gist"
(if-let [files (:files gist)]
- (zipmap (keys files) (map #(dissoc (second %) :filename) files))))
+ (zipmap (keys files) (map #(:content (second %)) files))))
(defn create-gist
"Create a gist. files is a map of filenames to contents.
5 test/tentacles/gists_test.clj
@@ -5,7 +5,6 @@
(def gist {:files {:file1 {:filename "file1" :content "content1" :type "text/plain"} :file2 {:filename "file2" :content "content2"}}})
(deftest files-are-parsed
- (let [files (gists/map-file gist)]
+ (let [files (gists/file-contents gist)]
(is (= (count files) 2))
- (is (= (get-in files [:file1 :content]) "content1"))
- (is (not (contains? (first files) :filename)))))
+ (is (= (get-in files [:file1]) "content1"))))

0 comments on commit 4e898e5

Please sign in to comment.
Something went wrong with that request. Please try again.