@@ -446,17 +446,29 @@ def send_req(meth, path, args)
446446 else
447447 expect ( frames [ -2 ] [ :method ] ) . to be_eql ( 'tap' )
448448 end
449- if Gem ::Version . new ( RUBY_VERSION ) >= Gem ::Version . new ( '3.0.0' )
449+ if Gem ::Version . new ( RUBY_VERSION ) >= Gem ::Version . new ( '4.0.0' )
450+ expect ( frames [ -2 ] [ :locals ] ) . to be_eql ( locals [ 1 ] )
451+ elsif Gem ::Version . new ( RUBY_VERSION ) >= Gem ::Version . new ( '3.0.0' )
450452 expect ( frames [ -2 ] [ :locals ] ) . to be_nil
451453 else
452454 expect ( frames [ -2 ] [ :locals ] ) . to be_eql ( locals [ 1 ] )
453455 end
454456
455- expect ( frames [ -3 ] [ :locals ] ) . to be_eql ( locals [ 2 ] )
456- expect ( frames [ -4 ] [ :locals ] ) . to be_eql ( locals [ 3 ] )
457- # Frames: -5 (and -6 in rails < 8.0) are not app frames, and have different
458- # contents in different Ruby versions.
459- if Gem ::Version . new ( Rails . version ) >= Gem ::Version . new ( '8.0.0' )
457+ if Gem ::Version . new ( RUBY_VERSION ) >= Gem ::Version . new ( '4.0.0' )
458+ expect ( frames [ -3 ] [ :locals ] ) . to be_eql ( locals [ 3 ] )
459+ else
460+ expect ( frames [ -3 ] [ :locals ] ) . to be_eql ( locals [ 2 ] )
461+ expect ( frames [ -4 ] [ :locals ] ) . to be_eql ( locals [ 3 ] )
462+ end
463+
464+ # Skip non-app frames, which vary based on Ruby and Rails versions
465+ if Gem ::Version . new ( RUBY_VERSION ) >= Gem ::Version . new ( '4.0.0' )
466+ if Gem ::Version . new ( Rails . version ) >= Gem ::Version . new ( '8.0.0' )
467+ expect ( frames [ -5 ] [ :locals ] ) . to be_eql ( locals [ 4 ] )
468+ else
469+ expect ( frames [ -4 ] [ :locals ] ) . to be_eql ( locals [ 4 ] )
470+ end
471+ elsif Gem ::Version . new ( Rails . version ) >= Gem ::Version . new ( '8.0.0' )
460472 expect ( frames [ -6 ] [ :locals ] ) . to be_eql ( locals [ 4 ] )
461473 else
462474 expect ( frames [ -7 ] [ :locals ] ) . to be_eql ( locals [ 4 ] )
0 commit comments