Skip to content

Commit e54d651

Browse files
author
Jolyon Pawlyn
committed
Prevent the clearing of instance variables after each test request with Rails 7
1 parent c1acc24 commit e54d651

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

test/support/rails_7_patch.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# HACK: to prevent the resetting of instances variables after each request in Rails 7
2+
# see https://github.com/rails/rails/pull/43735
3+
if Rails::VERSION::MAJOR >= 7
4+
module ActionController
5+
module Testing
6+
module Functional
7+
def clear_instance_variables_between_requests; end
8+
end
9+
end
10+
end
11+
end

test/test_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def silence_warnings
4949

5050
require 'support/rails_app'
5151

52+
require 'support/rails_7_patch'
5253
require 'support/ruby_2_6_rails_4_2_patch'
5354

5455
# require "rails/test_help"

0 commit comments

Comments
 (0)