On Tue, 16 Oct 2007 13:43:43 -0500, David Chelimsky wrote: > 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 Chelimsky at >> http://rubyforge.org/pipermail/rspec-users/2007-September/002965.html > > Which I first saw described by Jay Fields at > http://blog.jayfields.com/2006/12/rails-unit-testing-activerecord.html
I've been thinking about this throughout the day, and is this a pattern that should maybe be implemented in a more widespread pattern? For example, check that the model makes the requisite calls to the various validation functions? It would seem that unless you have some very custom validation methods, that you would be testing rails implementation of its validators, by running through all of the various checks manually. I guess maybe it depends on if you view the testing as mostly testing a black box, or if you assume some knowledge of the code internals? Thoughts? Steve _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users