On 10/16/07, Steve <[EMAIL PROTECTED]> wrote: > > > > You could expect a call to attr_accessible and then load your model file. > > > > Or, loop through all the column names in your model, and make sure > > that only the ones that are supposed to be accessible get set. > > > > Pat > > Expecting the call is what I had originally thought of, but couldn't > figure out how to write that test. Isn't attr_accessible called when you > create a new instance, so there wouldn't be time to setup an expectation > for the call?
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 Chelimsky at http://rubyforge.org/pipermail/rspec-users/2007-September/002965.html Pat _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users