Skip to content

Commit

Permalink
remove old api doc refs
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Apr 30, 2019
1 parent f4e1205 commit 94a0d1a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ impl Drop for Inner {
/// This function panics on nested call.
pub fn block_on<F>(f: F) -> Result<F::Item, F::Error>
where
F: Future,
F: IntoFuture,
{
RT.with(move |rt| rt.borrow_mut().get_mut().block_on(f))
RT.with(move |rt| rt.borrow_mut().get_mut().block_on(f.into_future()))
}

/// Runs the provided function, blocking the current thread until the resul
Expand Down Expand Up @@ -330,12 +330,11 @@ where
/// For unit testing, actix provides a request builder type and a simple handler runner. TestRequest implements a builder-like pattern.
/// You can generate various types of request via TestRequest's methods:
/// * `TestRequest::to_request` creates `actix_http::Request` instance.
/// * `TestRequest::to_service` creates `ServiceRequest` instance, which is used for testing middlewares and chain adapters.
/// * `TestRequest::to_from` creates `ServiceFromRequest` instance, which is used for testing extractors.
/// * `TestRequest::to_srv_request` creates `ServiceRequest` instance, which is used for testing middlewares and chain adapters.
/// * `TestRequest::to_srv_response` creates `ServiceResponse` instance.
/// * `TestRequest::to_http_request` creates `HttpRequest` instance, which is used for testing handlers.
///
/// ```rust
/// # use futures::IntoFuture;
/// use actix_web::{test, HttpRequest, HttpResponse, HttpMessage};
/// use actix_web::http::{header, StatusCode};
///
Expand All @@ -352,11 +351,11 @@ where
/// let req = test::TestRequest::with_header("content-type", "text/plain")
/// .to_http_request();
///
/// let resp = test::block_on(index(req).into_future()).unwrap();
/// let resp = test::block_on(index(req)).unwrap();
/// assert_eq!(resp.status(), StatusCode::OK);
///
/// let req = test::TestRequest::default().to_http_request();
/// let resp = test::block_on(index(req).into_future()).unwrap();
/// let resp = test::block_on(index(req)).unwrap();
/// assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
/// }
/// ```
Expand Down

0 comments on commit 94a0d1a

Please sign in to comment.