[Rspec-devel] context could yield an object, and be nested

David Astels dastels at daveastels.com
Mon May 29 06:46:12 EDT 2006


On 29-May-06, at 12:06 AM, itsme213 wrote:

>> I would accept duplication for enhanced clarity.
>
> Fair enough. Would you say this one is not clear?
>
> In an empty home
>   - the security system should be enabled
>   When a door is opened
>     - the system should beep
>     - the display should highlight the door
>     When the password is entered on time
>       - the beeping should stop
>       - the system should be disabled
>       - the display should highlight the door
>     When the password is not entered on time
>       - the alarm should go off
>       - the monitoring company should be notified

This looks fine, but what does the code look like?

> How would you suggest this one be written in rspec?

> In an empty home
>   - the security system should be enabled

> When a the system is triggered
>   - the system should beep
>   - the display should highlight the door

> When the password is entered on time after the system is triggered
>   - the beeping should stop
>   - the system should be disabled
>   - the display should highlight the door

> When the password is not entered on time after the system is triggered
>   - the alarm should go off
>   - the monitoring company should be notified



More information about the Rspec-devel mailing list