Skip to content

Commit

Permalink
Fixes #37116 - Enable bullet in the test environment
Browse files Browse the repository at this point in the history
bullet is a tool to find n+1 query patterns. We already have it enabled
in development, but not in testing. If we configure it to raise
exceptions, we should have better guards against inefficient patterns.
  • Loading branch information
ekohl committed Aug 19, 2024
1 parent 44160c0 commit cde235d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion bundler.d/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

gem 'rainbow', '>= 2.2.1'

gem 'bullet', '>= 6.1.0'
gem "parallel_tests"
gem 'spring', '>= 1.0', '< 3'
gem 'benchmark-ips', '>= 2.8.2'
Expand Down
1 change: 1 addition & 0 deletions bundler.d/test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
group :test do
gem 'bullet', '>= 6.1.0'
gem 'mocha', '~> 2.1'
gem 'minitest', '~> 5.1'
gem 'minitest-reporters', '~> 1.4', :require => false
Expand Down
6 changes: 6 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,10 @@
end
ASDeprecationTracker.resume!
end

config.after_initialize do
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.raise = true # raise an error if n+1 query occurs
end
end

0 comments on commit cde235d

Please sign in to comment.