summary refs log tree commit diff stats
path: root/src/posts.rs
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-08-30 20:00:42 -0400
committerBen Morrison <ben@gbmor.dev>2019-08-30 20:00:42 -0400
commitcf0ad9b11707abef27ee4acd00f3cfd679eeff23 (patch)
treecad84ab5be8f3af9fb0f210753744b1497423815 /src/posts.rs
parentcf6e3518160a3cff9892483a085080a0c92bd318 (diff)
downloadclinte-cf0ad9b11707abef27ee4acd00f3cfd679eeff23.tar.gz
fixed broken test, expanded test v0.3.3
Diffstat (limited to 'src/posts.rs')
-rw-r--r--src/posts.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/posts.rs b/src/posts.rs
index 88368a6..698f8a6 100644
--- a/src/posts.rs
+++ b/src/posts.rs
@@ -42,7 +42,8 @@ mod tests {
 
     #[test]
     fn post_new() {
-        let db = db::Conn::new();
+        let db = db::Conn::init("/tmp/clinte.db");
+        let db = db::Conn { conn: db };
         let mut stmt = db
             .conn
             .prepare("INSERT INTO posts (title, author, body) VALUES (:title, :author, :body)")
@@ -51,16 +52,18 @@ mod tests {
         let title = String::from("TEST TITLE");
 
         new(&mut stmt, &title, "TEST BODY").unwrap();
+        update("NEW TITLE", "TEST BODY", 1, &db).unwrap();
 
         let mut stmt = db
             .conn
             .prepare("SELECT * FROM posts WHERE title = :title")
             .unwrap();
 
+        let title = String::from("NEW TITLE");
         let out: String = stmt
             .query_row_named(&[(":title", &title)], |row| row.get::<usize, String>(1))
             .unwrap();
 
-        assert_eq!("TEST TITLE", &out);
+        assert_eq!("NEW TITLE", &out);
     }
 }