[Rspec-devel] Fwd: ActiveRecord fixtures support in RSpec
aslak.hellesoy at gmail.com
Mon Apr 24 17:59:25 EDT 2006
was sent to me
---------- Forwarded message ----------
From: Eric Hodel <drbrain at segment7.net>
Date: Apr 24, 2006 4:57 PM
Subject: Re: [Rspec-devel] ActiveRecord fixtures support in RSpec
To: aslak hellesoy <aslak.hellesoy at gmail.com>
On Apr 24, 2006, at 2:52 PM, aslak hellesoy wrote:
> [...] the code is very tightly coupled to Test::Unit (by opening
> the Test::Unit::TestCase class and adding class methods).
> In order to have RSpec work with ActiveRecord we have to be able to
> reuse this tightly coupled code. The way I see it now we have 2
> 1) Patch Rails
> Pull out the code that is coupled to Test::Unit and stick it in a
> module that can be included both by Test::Unit::TestCase and by
> whichever class we decide to do it from in RSpec (probably
> We'd have to produce a patch that is likely to be accepted by the
> rails team, which means that it should be 110% backwards compatible.
> 2) Write an adapter
> We can try to leave the Rails code untouched, and instead reimplement
> an identical API (fixtures, use_transactional_fixtures, etc) in RSpec
> and just have our implementation delegate to what's already in Rails.
> This would only delegate to the methods that set up and tear down the
> While I think option 1 is cleaner I think it's potentially a tougher
> sell to the Rails team. I suggest we give our first stab at something
> akin to option 2.
> I know Steve and Eric have looked a little bit into this. What are
> your thoughts on 1 vs 2? Can anyone think of other options?
I vote for option 1. It shouldn't be too difficult to make it
generic-enough and still backwards compatible.
The part that stomps on Test::Unit could be pulled into
test_helper.rb, I think, keeping the patch quite small.
Eric Hodel - drbrain at segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant
More information about the Rspec-devel