[rspec-devel] BehaviourRunner and ExampleSuite
aslak.hellesoy at gmail.com
Sat Sep 22 11:26:41 EDT 2007
The CHANGELOG says "Behaviour subclasses Test::Unit::TestCase".
However, when I look in the code, the only subclass of TestCase is
Example. There doesn't seem to be a Behaviour class at all anymore,
but there are plenty of variables in the code named 'behaviour'
For a long while we have been referring to "it" blocks as "examples",
and they correspond to test_* methods in xUnit speak. Further, we used
to call the describe blocks "behaviours" and they correspond to Test
classes in xUnit speak.
But now it looks like an "example" is analogous to a Test class?!?!
There are 9 (!) example_* files and it's virtually impossible to tell
where responsibilities are. Although I'm against extensive
documentation in code explaining how the code works internally
(because code should be self documenting) I think we're now at a point
where we need to add comments or clean things up bigtime.
I'm really confused.
On 9/22/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> 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
> In one single run, #prepare gets called twice, and returns the second
> time because of the @already_prepared check.
> 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.
> You who've been involved in the Test::Unit refactoring - are you
> planning to simplify things more and get rid of our own runner?
More information about the rspec-devel