[rspec-users] RSpec makes me want to write better code

Scott Taylor mailing_lists at railsnewbie.com
Fri Sep 26 13:24:28 EDT 2008

On Sep 26, 2008, at 1:18 PM, Mark Wilden wrote:

> On Fri, Sep 26, 2008 at 9:47 AM, Ashley Moran <ashley.moran at patchspace.co.uk 
> > wrote:
> (be sure to spec what attributes your classes have if you're scared  
> of pollution!)
> As part of the TDD process, I spec all attributes, but this doesn't  
> seem universal. Is this a misconception? Do people actually make  
> sure that all columns exist and can be written to and read from?

I usually end up doing something like this:

   columns = [:email, :message]
   columns.each do |column|
     it "should have a reader and writer for the column #{column}" do
       @invite.should respond_to(column)
       @invite.should respond_to("#{column}=")

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080926/1bd163ad/attachment.html>

More information about the rspec-users mailing list