diff --git a/pact_mock_server/src/builder.rs b/pact_mock_server/src/builder.rs index b4a3696c..0a5a271e 100644 --- a/pact_mock_server/src/builder.rs +++ b/pact_mock_server/src/builder.rs @@ -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 { + manager.spawn_mock_server(self) + } } #[cfg(test)]