[rspec-devel] BehaviourRunner and ExampleSuite

Brian Takita brian.takita at gmail.com
Sat Sep 22 23:33:25 EDT 2007

On 9/22/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> Hi,
> I've noticed that BehaviourRunner#prepare is invoked via two different chains:
> bin/spec -> CommandLine#run -> BehaviourRunner#run -> BehaviourRunner#prepare
> test/unit/testsuite.rb -> ExampleSute#run -> BehaviourRunner#prepare
Yes, this is an intermediate stage.
> In one single run, #prepare gets called twice, and returns the second
> time because of the @already_prepared check.
When we get rid of the BehaviourRunner, this issue should go away.
> This is all quite confusing to me, and the number of delegators in
> ExampleSuite makes it even more confusing. Now that we're using
> Test::Unit's runner it occurs to me that we should get rid of our own
> "runner" stuff, but there still seems to be a lot of redundancy. The
> code is plain hard to understand.
Can you explain the redundancy part?

The ExampleSuite is there to act as a bridge to the Test::Unit world.
The runner responsibilities of the old Behaviour object was moved to
the ExampleSuite object.
Would it be easier is the delegators were inlined?
I found the delegators easier to work with, because its less verbose
and the dependencies on the Example class object (Behaviour) and
Options is in one place, instead of spread out everywhere. I find this
easier and quicker to refactor because its all in one place.
That said, we can move the responsibilities around still. Its not optimal yet.
> You who've been involved in the Test::Unit refactoring - are you
> planning to simplify things more and get rid of our own runner?
I would like to get rid of the runner, but havn't gotten to that point yet.
I think it would be easier if we had a global $rspec_options variable
instead of having a $behaviour_runner global variable. That way, the
options do not need to be passed everywhere.
> Aslak
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the rspec-devel mailing list