[Rspec-devel] What is a context?
dchelimsky at gmail.com
Sun Jul 16 09:32:52 EDT 2006
On 7/16/06, Brian Takita <brian.takita at gmail.com> wrote:
> I'm thinking of adding documentation about contexts and specifications,
> however I'm not sure how to define a context.
> From the Stack tutorial, I noticed that a context is used to describet the
> state of the stack. Are context's meant to be limited to describing the
> state of the object? Should a context be used to describe a use case?
The approach demonstrated in the stack spec is as you describe - an
object or set of objects in a known state. This leads to specs
organized like this:
context "object, when in state 1" do
specify "should do z in response to message a" do
specify "should do y in response to message b" do
I think that the combination of context and specification names
provide use case (granular) descriptions:
object, when in state 1
- should do z in response to message a
- should do y in response to message b
This make sense? Anyone else see it differently?
context and specify work well for class level use cases, but It does
occur to me that there is room for some other structures for higher
level specs that a customer might understand. Maybe context and
specify are enough. Thoughts?
More information about the Rspec-devel