diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-16 09:07:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-16 09:07:58 +0300 |
commit | 334fbbb5d3822acc996a59e492fdace629cf7322 (patch) | |
tree | 166e928a548ce4055baf426e73f771eeda2901ec /spec | |
parent | d1bb6110842b87d5a6a05c326ed16edef167209a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/support/database_cleaner.rb | 2 | ||||
-rw-r--r-- | spec/support/rails/test_case_patch.rb | 53 |
2 files changed, 2 insertions, 53 deletions
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index f6339d7343c..60d82f7e92a 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -35,6 +35,8 @@ RSpec.configure do |config| puts "Recreating the database" start = Gitlab::Metrics::System.monotonic_time + ActiveRecord::AdvisoryLockBase.clear_all_connections! + ActiveRecord::Tasks::DatabaseTasks.drop_current ActiveRecord::Tasks::DatabaseTasks.create_current ActiveRecord::Tasks::DatabaseTasks.load_schema_current 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 |