Skip to content

Commit 5d64851

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

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/support/rails_7_patch.rb

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