In test/test_helper.rb
...
### Bullet (N+1 queries)
if ENV['BULLET']
Bullet.enable = true
require 'minitest/unit'
module MiniTestWithBullet
def before_setup
Bullet.start_request
super if defined?(super)
end
def after_teardown
super if defined?(super)
if Bullet.warnings.present?
warnings = Bullet.warnings.map{ |_k, warning| warning }.flatten.map{|warn| warn.body_with_caller}.join("\n-----\n\n")
flunk(warnings)
end
Bullet.end_request
end
end
class ActiveSupport::TestCase
include MiniTestWithBullet
end
end
I'm using Rails 4.2.11 & the configuration above raised bullet errors/detections, but wasn't showing a useful stack trace. I found using after_setup & before_teardown gave me the real stack trace in testing.