Skip to content

Commit

Permalink
Make tests run faster
Browse files Browse the repository at this point in the history
Locally, went from 77s to 20s
  • Loading branch information
MaxLap committed Nov 15, 2021
1 parent b3c781c commit 9224ec2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions example/Gemfile
Expand Up @@ -7,3 +7,5 @@ gem "good_migrations", path: ".."
gem "sqlite3"

gem "zeitwerk", github: "fxn/zeitwerk"

gem "bootsnap", require: false
1 change: 1 addition & 0 deletions example/config/boot.rb
Expand Up @@ -13,3 +13,4 @@
exit!
end
end
require "bootsnap/setup"
3 changes: 1 addition & 2 deletions test/good_migrations_test.rb
Expand Up @@ -47,8 +47,7 @@ def shell(command)
script = <<-SCRIPT
export BUNDLE_GEMFILE="Gemfile"
export RAILS_ENV="development"
rm -f Gemfile.lock db/*.sqlite3
bundle install
rm -f db/*.sqlite3
#{command}
SCRIPT
Bundler.with_unbundled_env do
Expand Down
10 changes: 10 additions & 0 deletions test/test_helper.rb
Expand Up @@ -4,3 +4,13 @@
require "minitest/autorun"
require "open3"
require "pry"

pre_test_setup_script = <<-SCRIPT
export BUNDLE_GEMFILE="Gemfile"
export RAILS_ENV="development"
rm -f Gemfile.lock
bundle install
SCRIPT
Bundler.with_unbundled_env do
Open3.capture3(pre_test_setup_script, chdir: "example")
end

0 comments on commit 9224ec2

Please sign in to comment.