Skip to content

Commit

Permalink
Compile prepare_mock_db() conditionally based on "mock" feature
Browse files Browse the repository at this point in the history
  • Loading branch information
shpun817 committed Jul 21, 2022
1 parent c3d4d45 commit d0e2a63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/rocket_example/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ features = [
[dev-dependencies]
tokio = "1.20.0"

[features]
mock = ["sea-orm/mock"]

[[test]]
name = "mock"
required-features = ["sea-orm/mock"]
required-features = ["mock"]
1 change: 1 addition & 0 deletions examples/rocket_example/core/tests/prepare.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use ::entity::post;
use sea_orm::*;

#[cfg(feature = "mock")]
pub fn prepare_mock_db() -> DatabaseConnection {
MockDatabase::new(DatabaseBackend::Postgres)
.append_query_results(vec![
Expand Down

0 comments on commit d0e2a63

Please sign in to comment.