Skip to main content

assert_options_default

assert_options_default checks that the latest recorded publish carried no per-message settings, so the publish policy's defaults applied.

A publish carries settings only when a builder step or a transform set them; otherwise the policy named at the mount site decides. The records that carry settings are the same as for with_options: every publish the runtime makes, in a slot record and in a destination record. The assertion panics when the latest publish carried settings, naming their type.

Example​

#[tokio::test]
async fn a_standard_order_ships_at_the_default_priority() -> Result<(), Box<dyn Error>> {
let tb = TestApp::start(app()).await?;
tb.broker::<MemoryBroker>()
.message(&Order {
id: 7,
express: false,
})
.to("orders")
.publish()
.await?;

tb.out::<Shipments>()
.assert_called_once()
.assert_options_default();
Ok(())
}