lib/cranky/factory.rb
def debug(*args)
      item = build(*args)
      invalid_item = Array(item).find(&:invalid?)
      if invalid_item
        if invalid_item.errors.respond_to?(:messages)
          errors = invalid_item.errors.messages
        else
          errors = invalid_item.errors
        end
        raise "Oops, the #{invalid_item.class} created by the Factory has the following errors: #{errors}"
      end
      item
    end
def debug(*args)
      item = build(*args)
      invalid_item = Array(item).find(&:invalid?)
      if invalid_item
        if invalid_item.errors.respond_to?(:messages)
          errors = invalid_item.errors.messages
        else
          errors = invalid_item.errors
        end
        raise "Oops, the #{invalid_item.class} created by the Factory has the following errors: #{errors}"
      end
      item
    end
Can be left in your tests as an alternative to build and to warn if your factory method
 ever starts producing invalid instances