Skip to content

Commit

Permalink
Prevent the clearing of instance variables after each test request wi…
Browse files Browse the repository at this point in the history
…th Rails 7
  • Loading branch information
Jolyon Pawlyn committed Dec 16, 2021
1 parent c1acc24 commit 5d64851
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/support/rails_7_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

# HACK: to prevent the resetting of instance variables after each request in Rails 7
# see https://github.com/rails/rails/pull/43735
if Rails::VERSION::MAJOR >= 7
module ActionController
module Testing
module Functional
def clear_instance_variables_between_requests; end
end
end
end
end
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def silence_warnings

require 'support/rails_app'

require 'support/rails_7_patch'
require 'support/ruby_2_6_rails_4_2_patch'

# require "rails/test_help"
Expand Down

0 comments on commit 5d64851

Please sign in to comment.