first test and needed dependency to diesel added (test not complete yet)
This commit is contained in:
parent
1645ed984d
commit
58f6b349df
@ -7,3 +7,4 @@ edition = "2018"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
diesel = { version = "*", features = ["sqlite"] }
|
||||
|
@ -1,7 +1,29 @@
|
||||
extern crate diesel;
|
||||
|
||||
pub mod db;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use diesel::Connection;
|
||||
use diesel::SqliteConnection;
|
||||
|
||||
fn establish_connection() -> SqliteConnection {
|
||||
let database_url = "test.db";
|
||||
SqliteConnection::establish(&database_url)
|
||||
.unwrap_or_else(|_| panic!("Error connecting to {}", database_url))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_users() {
|
||||
use schema::dsl::*;
|
||||
let connection = establish_connection();
|
||||
// db::schema::
|
||||
|
||||
// users.loa
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user