1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/features/support/factories.rb

23 lines
472 B
Ruby

ActiveRecord::Base.establish_connection(
adapter: "sqlite3",
database: ":memory:",
)
migration_class =
if ActiveRecord::Migration.respond_to?(:[])
ActiveRecord::Migration[4.2]
else
ActiveRecord::Migration
end
class CreateSchema < migration_class
def self.up
create_table :categories, force: true do |t|
t.string :name
end
end
end
CreateSchema.suppress_messages { CreateSchema.migrate(:up) }
class Category < ActiveRecord::Base; end