Re: [rspec-users] Example for attr_accessible?

2007-10-17 Thread Wincent Colaiuta
El 17/10/2007, a las 7:26, Pat Maddox [EMAIL PROTECTED] escribió: Well, you'll find differing opinions on this. Every time I've done validations I've written a spec that actually exercises the behavior. For example class Person ActiveRecord::Base validates_presence_of :name end

Re: [rspec-users] Example for attr_accessible?

2007-10-16 Thread David Chelimsky
On 10/16/07, Pat Maddox [EMAIL PROTECTED] wrote: describe Chicken do it should make only :name and :age attr_accessible do Chicken.should_receive(:attr_accessible).with(:name, :age) load #{RAILS_ROOT}/app/models/chicken.rb end end I first saw this technique described by David

[rspec-users] Example for attr_accessible?

2007-10-15 Thread Steve
Is anyone out there writing specs to check attr_accessible fields? I had originally written my spec to check for allowing the desired fields, and then none of the other regular db fields. Unfortunately this isn't satisfactory, because attr_protected could have been used instead, which of course