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

itsme213 itsme213 at hotmail.com
Sun May 28 19:19:56 EDT 2006


> IMHO this is would be a source of complexity & confusion.
>
> 1) The more distributed the context and/or specifications are, the
> more work it is to understand exactly what is going on.
>
> 2) Both contexts and specification should be as clear and simple as
> possible.

I agree with both these. Would you agree with this third principle?

3) Both contexts and specifications should not be duplicated unnecessarily.

For example, a home security spec:

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

I think the "-" lines are specs, others are contexts. Would this be 
reasonable?

Would structuring the spec like this contradict principles #1,2,3?

Thanks.


More information about the Rspec-devel mailing list