# This patch is only required when using rails 4.2 with ruby 2.6
#
# https://github.com/rails/rails/issues/34790

if RUBY_VERSION>='2.6.0'
  if Rails.version < '5'
    class ActionController::TestResponse < ActionDispatch::TestResponse
      def recycle!
        # hack to avoid MonitorMixin double-initialize error:
        @mon_mutex_owner_object_id = nil
        @mon_mutex = nil
        initialize
      end
    end
  else
    puts "Monkeypatch for ActionController::TestResponse no longer needed"
  end
end

Fix verify pipeline oc-id tests
Fix verify pipeline oc-id tests

oc-id is built on rails 4.2.11 which fails tests with:

`ThreadError: already initialized` with Ruby 2.6.x

This commit adds src/oc-id/spec/support/monkeypatch.rb to prevent rails
from reusing `ActionController::TestResponse` object in tests.

See: https://github.com/rails/rails/issues/34790

Signed-off-by: Christopher A. Snapp <dffaa860ed97a8fe2bd7fd9817f16f80af273fae@chef.io>
