diff options
Diffstat (limited to 'spec/support/rails/test_case_patch.rb')
-rw-r--r-- | spec/support/rails/test_case_patch.rb | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/spec/support/rails/test_case_patch.rb b/spec/support/rails/test_case_patch.rb deleted file mode 100644 index 161e1ef2a4c..00000000000 --- a/spec/support/rails/test_case_patch.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true -# -# This file pulls in the changes in https://github.com/rails/rails/pull/38063 -# to fix controller specs updated with the latest Rack versions. -# -# This file should be removed after that change ships. It is not -# present in Rails 6.0.2.2. -module ActionController - class TestRequest < ActionDispatch::TestRequest #:nodoc: - def self.new_session - TestSessionPatched.new - end - end - - # Methods #destroy and #load! are overridden to avoid calling methods on the - # @store object, which does not exist for the TestSession class. - class TestSessionPatched < Rack::Session::Abstract::PersistedSecure::SecureSessionHash #:nodoc: - DEFAULT_OPTIONS = Rack::Session::Abstract::Persisted::DEFAULT_OPTIONS - - def initialize(session = {}) - super(nil, nil) - @id = Rack::Session::SessionId.new(SecureRandom.hex(16)) - @data = stringify_keys(session) - @loaded = true - end - - def exists? - true - end - - def keys - @data.keys - end - - def values - @data.values - end - - def destroy - clear - end - - def fetch(key, *args, &block) - @data.fetch(key.to_s, *args, &block) - end - - private - - def load! - @id - end - end -end |