Skip to content

Commit

Permalink
Disable documentation for mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
MOZGIII committed Feb 15, 2020
1 parent 4815a33 commit b54ec3b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
18 changes: 12 additions & 6 deletions pubnub-core/src/mock/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ use std::pin::Pin;

use mockall::mock;

mock! {
pub Runtime {
fn mock_workaround_spawn<O: 'static>(&self, future: Pin<Box<dyn Future<Output = O> + Send + 'static>>) {}
}
trait Clone {
fn clone(&self) -> Self;
mod gen {
#![allow(missing_docs)]
use super::*;

mock! {
pub Runtime {
fn mock_workaround_spawn<O: 'static>(&self, future: Pin<Box<dyn Future<Output = O> + Send + 'static>>) {}
}
trait Clone {
fn clone(&self) -> Self;
}
}
}
pub use gen::*;

impl std::fmt::Debug for MockRuntime {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Expand Down
38 changes: 21 additions & 17 deletions pubnub-core/src/mock/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,29 @@ use mockall::mock;
#[error("mock tranport error")]
pub struct MockTransportError;

mock! {
pub Transport {
#[allow(clippy::type_complexity)]
fn mock_workaround_publish_request_v1(
&self,
req: request::PublishV1,
) -> Pin<Box<dyn Future<Output = Result<Timetoken, MockTransportError>> + Send + 'static>> {}

#[allow(clippy::type_complexity)]
fn mock_workaround_subscribe_request_v2(
&self,
req: request::SubscribeV2,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Message>, Timetoken), MockTransportError>> + Send + 'static>>
{}
}
trait Clone {
fn clone(&self) -> Self {}
mod gen {
#![allow(missing_docs)]
use super::*;

mock! {
pub Transport {
fn mock_workaround_publish_request_v1(
&self,
req: request::PublishV1,
) -> Pin<Box<dyn Future<Output = Result<Timetoken, MockTransportError>> + Send + 'static>> {}

fn mock_workaround_subscribe_request_v2(
&self,
req: request::SubscribeV2,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Message>, Timetoken), MockTransportError>> + Send + 'static>>
{}
}
trait Clone {
fn clone(&self) -> Self {}
}
}
}
pub use gen::*;

// We implement the mock manually cause `mockall` doesn't support `async_trait` yet.
#[async_trait]
Expand Down

0 comments on commit b54ec3b

Please sign in to comment.