On Thu, Nov 27, 2008 at 11:03 AM, David Chelimsky <[EMAIL PROTECTED]>wrote:
> On Thu, Nov 27, 2008 at 9:06 AM, <[EMAIL PROTECTED]> > wrote: > > > it "should be invalid without an approved size" do > > @adtag.attributes = valid_adtag_attributes.except(:size) # ONE > > attributes= does NOT set any attributes that are not included in the > hash. In this case it does not try to assign the value of :size. > > As for not showing in the test log, I believe (but I'm not sure) that > AR will not run an SQL update unless attributes= changes the value of > any of the attributes it assigns. In this case, that is not happening, > so no query. > > > @adtag.errors.on(:size).should eql("is not included in the list") # > TWO > > @adtag.should have(1).error_on(:size) # THREE > > @adtag.should_not be_valid > And since it's the valid? call which sets the errors, even if you address the problems pointed out by David, those errors expectations won't be met if you do things in this order. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users