[rspec-users] Fixtures considered harmful?
mailing_lists at railsnewbie.com
Fri May 18 13:59:17 EDT 2007
On May 18, 2007, at 12:35 PM, Wincent Colaiuta wrote:
> El 18/5/2007, a las 17:32, aslak hellesoy escribió:
>>> But looking, for example, at the examples at <http://
>>> rspec.rubyforge.org/documentation/rails/writing/models.html>, almost
>>> all of them use fixtures. Can someone please clarify why use of
>>> fixtures are not recommended?
>> We should get this up on the web page, but I'll provide some insight
>> here. The reason why we don't recommend them is along the lines why
>> we're not crazy about DRYing up specs. Let me repeat David's Agile
>> Spec Manifesto (of which I am the second subscriber):
>> We prefer clear spec over well factored specs. (Clarity is king).
>> When everything is in your face you can picture it easier than when
>> it's in several different locations (fixture files, helper files
> Thanks for the explanation, Aslak. It's very clear. I think a
> sentence or two to that effect should definitely go up on the website.
I just wanted to add my $0.02.
I've started using fixtures *only* for field validations. This
quickly tells me that I have a good record, that I can unset a field,
and that it is invalid.
Fixtures really start to become a pain, though, if the fixture has a
foreign key, and so largely I stay away from them.
The issue of fixtures mainly seems to be a personal preference, and
largely context dependent. I think David's advise on this one is
good, though, and if you stick to that it's hard to go wrong.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users