Make tests compile again

pull/813/head
Ana Gelez 4年前 committed by Mina Galić
コミット 8aa4ae4302
署名者: igalic
GPGキーID: ACFEFF7F6A123A86

バイナリファイルは表示されません。

バイナリファイルは表示されません。

@ -330,6 +330,9 @@ mod tests {
searcher: Arc::new(search::tests::get_searcher(&CONFIG.search_tokenizers)),
worker: Arc::new(ScheduledThreadPool::new(2)),
user: None,
actors: Arc::new(
riker::actors::ActorSystem::new().expect("Couldn't create test actor system"),
),
}
}
}

@ -49,6 +49,7 @@ mod module {
#[cfg(test)]
mod module {
use crate::{db_conn::DbConn, search, users};
use riker::actors::ActorSystem;
use rocket::{
request::{self, FromRequest, Request},
Outcome, State,
@ -62,6 +63,7 @@ mod module {
pub user: Option<users::User>,
pub searcher: Arc<search::Searcher>,
pub worker: Arc<ScheduledThreadPool>,
pub actors: Arc<ActorSystem>,
}
impl<'a, 'r> FromRequest<'a, 'r> for PlumeRocket {
@ -72,11 +74,13 @@ mod module {
let user = request.guard::<users::User>().succeeded();
let worker = request.guard::<'_, State<'_, Arc<ScheduledThreadPool>>>()?;
let searcher = request.guard::<'_, State<'_, Arc<search::Searcher>>>()?;
let actors = request.guard::<'_, State<'_, Arc<ActorSystem>>>()?;
Outcome::Success(PlumeRocket {
conn,
user,
worker: worker.clone(),
searcher: searcher.clone(),
actors: actors.clone(),
})
}
}

@ -165,7 +165,7 @@ pub(crate) mod tests {
let newtitle = random_hex()[..8].to_owned();
post.title = newtitle.clone();
post.update(conn, &searcher).unwrap();
post.update(conn).unwrap();
searcher.commit();
assert_eq!(
searcher.search_document(Query::from_str(&newtitle).unwrap(), (0, 1))[0].id,

読み込み中…
キャンセル
保存