Arrange Act Assert (AAA) style syntax for rspec2

I’d like to be able to test w/ this methodology, and i’m having
trouble figuring out where to hook in to rspec to do it. Near as I
can tell, the flow is this:

run all of the before filters in the order of highest to lowest
context

<<-- I need to run something right here

run tests

run all of the after filters in the order of highest to lowest context

Is there any way to create a before filter that is always run after
all of the others?

On Jan 21, 2011, at 10:32 AM, JDeville wrote:

run all of the after filters in the order of highest to lowest context

Is there any way to create a before filter that is always run after
all of the others?

This sounds complicated.

In BDD, we use Given/When/Then to mean what you mean by AAA. You can do
this all right in the example:

it “does something” do

given

when

then

end

You can use before hooks to set up the givens if you want (though be
careful, as this is widely abused leading to less readability), but the
when and then should be right in the example.

HTH,
David

Thanks David,
What I really need is an explicit way of calling ‘when’. You helped
me find the rspec-given gem, so I’ll try that.

I think that, and the spies support from the Bourne gem will give me
what I’ve been hoping for.

Thanks for everything David.