Our system will turn the lights on when a guest arrives:
$when::
home.guest_arrived (name)
lights.on
Then we have a sensor which we check to see if they're truly on:
$when::
lights.on
lights.check
We can also mock the systems that we don't have access to yet, let's pretend the lights are bright:
0 $mock::
lights.check
. (lightIntensity
="bright"
)
We also have a chimes system: one that can greet guests. Let's configure it to greet only Jane...
$when::
home.guest_arrived (name is "Jane"
)
chimes.welcome (name="Jane"
="Jane")
Since we don't have the chimes system built yet, we'll just mock it:
0 $mock::
chimes.welcome
. (greeting
=("Greetings, " + name)
)
You can see how this new $when
rule matches only Jane
- so other guests will not be notified... something you can test: so why don't you test to see if John is greeted (hint: change Jane to John in the story and see what happens) !
You need to log in to post a comment!