[Rspec-devel] ActiveRecord fixtures support in RSpec

Eric Hodel drbrain at segment7.net
Wed Apr 26 16:19:01 EDT 2006

On Apr 26, 2006, at 12:26 PM, aslak hellesoy wrote:

>> 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
>> fixtures.
> i have toyed a little with option 2 and the syntax. what do you  
> think of this:
> context 'Empolyee' do
>   fixtures :employees
>   specify 'should have name' do
>     employees(:aslak).name.should.equal 'aslak'
>   end
> end
> structurally this is the same as test::unit rails fixtures. the
> implementation on the rspec side will be completely different, since
> it would require implementation of extra methods on Context and
> dynamically adding methods to the execution context (e.g. the emplyees
> method).
> but without going in too much detail about the implementation - how do
> you like the syntax?

I think it looks fine and benefits from familiarity with Rails.

Eric Hodel - drbrain at segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant


More information about the Rspec-devel mailing list