A lights spec example Pub   Share

Specifications

Specifications, like a-lights-spec deal with the actual implementation of the system.

Our system will turn the lights on when a guest arrives:

$when:: home.guest_arrived (name)
   lights.on
$when:: home.guest_arrived (name == "Jane")
   chimes.welcome (name="Jane"="Jane")

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 messages that we don't have access to yet (suppose we did not integrate a light intensity checking system or a voice greeting system, so we'll mock them for now):

0 $mock:: lights.check
   . (light="bright")
0 $mock:: chimes.welcome
   . (greeting=("Greetings, " + name))

As you can see, specifications are simply wiki topics, with special annotations for messages, conditions, mocks and such.


Was this useful?  

By: Razie | 2025-04-25 | Tags: spec , dsl


( | History | Print ) this page.

You need to log in to post a comment!

© Copyright DieselApps, 2012-2026, all rights reserved.