spec/bullet_spec.rb in bullet-5.6.1 vs spec/bullet_spec.rb in bullet-5.7.0
- old
+ new
@@ -2,11 +2,10 @@
describe Bullet, focused: true do
subject { Bullet }
describe '#enable' do
-
context 'enable Bullet' do
before do
# Bullet.enable
# Do nothing. Bullet has already been enabled for the whole test suite.
end
@@ -89,9 +88,29 @@
describe '#add_whitelist' do
context "for 'special' class names" do
it 'is added to the whitelist successfully' do
Bullet.add_whitelist(:type => :n_plus_one_query, :class_name => 'Klass', :association => :department)
expect(Bullet.get_whitelist_associations(:n_plus_one_query, 'Klass')).to include :department
+ end
+ end
+ end
+
+ describe '#delete_whitelist' do
+ context "for 'special' class names" do
+ it 'is deleted from the whitelist successfully' do
+ Bullet.add_whitelist(:type => :n_plus_one_query, :class_name => 'Klass', :association => :department)
+ Bullet.delete_whitelist(:type => :n_plus_one_query, :class_name => 'Klass', :association => :department)
+ expect(Bullet.whitelist[:n_plus_one_query]).to eq({})
+ end
+ end
+
+ context 'when exists multiple definitions' do
+ it 'is deleted from the whitelist successfully' do
+ Bullet.add_whitelist(:type => :n_plus_one_query, :class_name => 'Klass', :association => :department)
+ Bullet.add_whitelist(:type => :n_plus_one_query, :class_name => 'Klass', :association => :team)
+ Bullet.delete_whitelist(:type => :n_plus_one_query, :class_name => 'Klass', :association => :team)
+ expect(Bullet.get_whitelist_associations(:n_plus_one_query, 'Klass')).to include :department
+ expect(Bullet.get_whitelist_associations(:n_plus_one_query, 'Klass')).to_not include :team
end
end
end
describe '#perform_out_of_channel_notifications' do