On Mon, Jan 18, 2010 at 5:17 AM, David Chelimsky <dchelim...@gmail.com>wrote:
> On Mon, Jan 18, 2010 at 4:01 AM, Pat Maddox <mailingli...@patmaddox.com> > wrote: > ... > > class User < ActiveRecord::Base > > named_scope :admins, :conditions => {:admin => true} > > end > > > > describe User, "admins" do > > it "should include users with admin flag" do > > admin = User.create! :admin => true > > User.admin.should include(admin) > > end > > > > it "should not include users without admin flag" do > > admin = User.create! :admin => false > > User.admin.should_not include(admin) > > end > > end > > Small style matter, but I've leaning towards more declarative sounding > example names: > > describe User, ".admins" do > it "includes users with admin flag" do > admin = User.create! :admin => true > User.admin.should include(admin) > end > > it "excludes users without admin flag" do > non_admin = User.create! :admin => false > User.admin.should_not include(non_admin) > end > end > > class User < ActiveRecord::Base > named_scope :admins, :conditions => {:admin => true} > end > > We still have 'should' in the examples, but this produces more > 'spec-like' output: > > User.admins > includes users with admin flag > excludes users without admin flag I agree, David. I've been omitting "should" from the beginning. For me, it made the start of every example look too similar. Regards, Craig
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users