[Rspec-devel] Rspec/Test::Unit Integration

Brian Takita brian.takita at gmail.com
Thu Jul 6 12:07:52 EDT 2006


>
> Ideally, I want to move towards all
> specs, all the time. But if comingling tests and specs gets me there
> gradually, that's fine w/ me as a temporary measure.


I slept on this a little bit.
In the patch, I am still (or at least intent on) using the ContextRunner,
thus using the Rspec framework.

A new class the extended the TestCase was created, as well as extending it
with the ContextMethods module and including the ExecutionContextMethods
module. I extracted the methods of Context and ExecutionContext into the
modules.
This gives access to the setup and teardown methods in TestCase.

So bascially, the instance of the TestCase subclass became the
ExecutionContext. ExecutionContext by itself seems very clean (not many
methods). If Rspec can provide a hook to extend it, then you can use other
libraries inside the your specs.

Something like
context "Integrating with Test::Unit" < Test::Unit::TestCase do
end

or

context "Integrating with Test::Unit" do
  inherit Test::Unit::TestCase
end

perhaps?

It's unfortunate that TestCases are not easily extendable.

On 7/6/06, David Chelimsky <dchelimsky at gmail.com> wrote:
>
> On 7/6/06, Brian Takita <brian.takita at gmail.com> wrote:
> > Are tests and specs mutually exclusive?
>
> Apparently not.
>
> > If not, when would one want to use specs vs using tests and vice versa?
>
> I think mixing them is confusing. Ideally, I want to move towards all
> specs, all the time. But if comingling tests and specs gets me there
> gradually, that's fine w/ me as a temporary measure. For example,
> right now the rails plugin doesn't do everything I want it to do, so
> I'm using test/unit but mixing in rspec expectation syntax. It's a
> step.
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-devel/attachments/20060706/177a8d31/attachment.html 


More information about the Rspec-devel mailing list