= SpecSupport

= check_all_columns

After building a factory that fills out all the
attributes (columns) of an ActiveRecord model,
I want to make sure all attributes/columns
actually have data.

This aids in avoiding the gotcha where a belongs_to
has a name that is not exactly matching with the _id
column, which goes undetected in many naive tests
(a simple build on the belongs_to will pass, a save
will pass, a reload and reading back the belongs_to
will pass and indicate correct values (because
reload does not touch values that are not actually
columns). Reading all the _id columns is one way
to detect this issue.

Example usage:

``ruby
describe Contact do

  context "has all columns for a full factory" do
    contact = FactoryGirl.create(:full_contact)
    contact = Contact.find(contact.id)
    check_all_columns(contact)
  end

end
``

= SpecSupport

= check_all_columns

After building a factory that fills out all the
attributes (columns) of an ActiveRecord model,
I want to make sure all attributes/columns
actually have data.

This aids in avoiding the gotcha where a belongs_to
has a name that is not exactly matching with the _id
column, which goes undetected in many naive tests
(a simple build on the belongs_to will pass, a save
will pass, a reload and reading back the belongs_to
will pass and indicate correct values (because
reload does not touch values that are not actually
columns). Reading all the _id columns is one way
to detect this issue.

Example usage:

  describe Contact do

    context "has all columns for a full factory" do
      contact = FactoryGirl.create(:full_contact)
      contact = Contact.find(contact.id)
     check_all_columns(contact)
   end

  end

Use implicit quoting for code samples
Use implicit quoting for code samples
