BB.Test.RecordingActuator (bb v0.27.0)

Copy Markdown View Source

Actuator that forwards every received command message to a test process.

Before starting the robot, put the recipient pid into persistent term:

:persistent_term.put({BB.Test.RecordingActuator, MyRobot}, self())

The actuator looks up the recipient at init and sends {:received, :command, message} for each command, whichever transport delivered it - a driver can't tell, and shouldn't need to.

It deliberately does not subscribe to its own command topic: the framework owns that subscription, and a double that subscribed for itself would pass the tests whether or not the framework did its job.

Pass subscribe_to: to have it subscribe to some other topic. Messages arriving there are forwarded as {:received, :info, message}, which is how the tests check that the server leaves a driver's own subscriptions alone.