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

David Astels dastels at daveastels.com
Mon May 29 12:37:07 EDT 2006


On 29-May-06, at 12:50 PM, itsme213 wrote:
>
> Hmm. If I understand your reasoning, then why not go the logical  
> next step
> and do further un-distribute as follows:
>
> ------------
> When the password is entered on time after the system is triggered the
> beeping should stop
>
> When the password is entered on time after the system is triggered the
> system should be disabled
>
> When the password is entered on time after the system is triggered the
> display should highlight the door
> ------------

The context in each of these is identical... so all 3 specs run in  
the same context.  That's idea behind the context concept.  It's not  
for removing/minimizing duplication, it's for providing a contained,  
cohesive environment for the contained specs to run in.

> It seems to me that nested contexts and r-spec's context-specification
> separation are both doing very similar "distribution".

Yes, but in rSpec we stop at one level.  Having hierarchical contexts  
confuses things... you have to look in several places to see what the  
"context" for a specific spec is, rather than just a single place.

Dave



More information about the Rspec-devel mailing list