Skip to content

Commit

Permalink
fix: Add a function to attach a mock server to a known manager
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Jul 2, 2024
1 parent 82208f6 commit fba93b6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pact_mock_server/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ impl MockServerBuilder {
let manager = guard.get_or_insert_with(|| ServerManager::new());
manager.spawn_mock_server(self)
}

/// Starts the mockserver, consuming this builder and registers it with the server manager.
/// The mock server tasks will be spawned on the server manager's runtime.
/// Returns the mock server instance.
pub fn attach_to_manager(self, manager: &mut ServerManager) -> anyhow::Result<MockServer> {
manager.spawn_mock_server(self)
}
}

#[cfg(test)]
Expand Down

0 comments on commit fba93b6

Please sign in to comment.