Skip to content

Commit

Permalink
Stop nuking the DB every time rspec runs
Browse files Browse the repository at this point in the history
This practice seems to have derived from having non-rails_helper'd code
writing to the database, as with our old `./lib` directory.  It is
unnecessary for anything using rails_helper, however, which now includes all
the code that writes to the DB during tests.

We already have transactional fixtures turned on so every change
during the rspec suite is atomically rolled back at the end of the example
where it was made.

Also, we use the fixtures directory, but we don't use it for
ActiveRecord fixtures, so that config in rails_helper is misleading.
  • Loading branch information
atz committed Aug 2, 2018
1 parent 3f1f331 commit bdb332f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
Rails.application.load_tasks
Rake::Task["db:reset"].invoke

# auto-require all ruby files in the support directory
Dir[Rails.root.join('spec', 'support', '*.rb')].each { |f| require f }
Expand All @@ -18,7 +16,7 @@

RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# config.fixture_path = "#{::Rails.root}/spec/fixtures"

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
Expand Down

0 comments on commit bdb332f

Please sign in to comment.