thoughtbot--factory_bot/features/support/factories.rb

24 lines
472 B
Ruby
Raw Normal View History

2009-09-15 19:47:47 +00:00
ActiveRecord::Base.establish_connection(
adapter: "sqlite3",
database: ":memory:",
2009-09-15 19:47:47 +00:00
)
migration_class =
if ActiveRecord::Migration.respond_to?(:[])
ActiveRecord::Migration[4.2]
else
ActiveRecord::Migration
end
class CreateSchema < migration_class
2009-09-15 19:47:47 +00:00
def self.up
create_table :categories, force: true do |t|
t.string :name
end
2009-09-15 19:47:47 +00:00
end
end
CreateSchema.suppress_messages { CreateSchema.migrate(:up) }
2012-07-27 18:10:38 +00:00
class Category < ActiveRecord::Base; end