Testing Unused Eager Loading Notifications in Bullet
This test suite examines the UnusedEagerLoading notification functionality in the Bullet gem, focusing on detecting and reporting unnecessary eager loading in Rails applications. The tests verify proper formatting and content of notification messages when unused eager loading is detected.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
flyerhzm/bullet
spec/bullet/notification/unused_eager_loading_spec.rb
# frozen_string_literal: true
require 'spec_helper'
module Bullet
module Notification
describe UnusedEagerLoading do
subject { UnusedEagerLoading.new([''], Post, %i[comments votes], 'path') }
it do
expect(subject.body).to eq(
" Post => [:comments, :votes]
Remove from your query: .includes([:comments, :votes])"
)
end
it { expect(subject.title).to eq('AVOID eager loading in path') }
end
end
end