fix bullet/onceler interaction
with nested specs, where the other group has :once stuff, but the inner does not Change-Id: I2145cba249b5cbeb82c19ef47037674ac867f44d Reviewed-on: https://gerrit.instructure.com/159901 Tested-by: Jenkins Reviewed-by: Rob Orton <rob@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
0f14bf4d93
commit
4bd3764ac0
|
@ -481,8 +481,11 @@ RSpec.configure do |config|
|
|||
if Bullet.enable?
|
||||
config.before(:each) do |example|
|
||||
Bullet.start_request
|
||||
possible_objects, impossible_objects =
|
||||
example.example_group.onceler.instance_variable_get(:@bullet_state)
|
||||
# we walk the example group chain until we reach one that actually recorded something
|
||||
oncie = example.example_group
|
||||
oncie = oncie.superclass while oncie && !oncie.onceler&.tape && oncie.superclass.respond_to?(:onceler)
|
||||
|
||||
possible_objects, impossible_objects = oncie.onceler.instance_variable_get(:@bullet_state)
|
||||
possible_objects&.each { |object| Bullet::Detector::NPlusOneQuery.possible_objects.add(object) }
|
||||
impossible_objects&.each { |object| Bullet::Detector::NPlusOneQuery.impossible_objects.add(object) }
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue