module ThoughtBot::Shoulda::ActiveRecord::Macros
def should_have_db_columns(*columns)
should_have_db_columns :id, :email, :name, :created_at
Ensure that the given columns are defined on the models backing SQL table.
def should_have_db_columns(*columns) column_type = get_options!(columns, :type) klass = model_class columns.each do |name| test_name = "have column #{name}" test_name += " of type #{column_type}" if column_type should test_name do column = klass.columns.detect {|c| c.name == name.to_s } assert column, "#{klass.name} does not have column #{name}" end end end