Skip to content

Instantly share code, notes, and snippets.

@garyharan garyharan/rails_helper.rb

Last active Mar 15, 2017
Embed
What would you like to do?
Speed up tests marginally
# ...
config.before(:suite) do
connection = ActiveRecord::Base.connection
query = connection.tables.map { |t| "ALTER TABLE #{t} SET UNLOGGED;" }.join("\n")
# one line for each foreign_key at the end of your schema.rb
ActiveRecord::Migration.remove_foreign_key "reports", "users"
connection.execute(query)
end
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.