[Rspec-devel] ActiveRecord fixtures support in RSpec

aslak hellesoy aslak.hellesoy at gmail.com
Wed Apr 26 15:26:52 EDT 2006

> 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'

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

but without going in too much detail about the implementation - how do
you like the syntax?


More information about the Rspec-devel mailing list