Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authlogic is incompatible with Minitest v5.19.0 and later #766

Open
4 tasks done
toncid opened this issue Aug 23, 2023 · 2 comments
Open
4 tasks done

Authlogic is incompatible with Minitest v5.19.0 and later #766

toncid opened this issue Aug 23, 2023 · 2 comments

Comments

@toncid
Copy link

toncid commented Aug 23, 2023

ISSUES THAT DO NOT FOLLOW THIS TEMPLATE WILL BE CLOSED IMMEDIATELY.

  • This is not a usage question.
    • Our volunteers' time is limited, so please ask usage questions on StackOverflow.
  • This is not a security issue.
  • This bug is reproducible with a clean install of authlogic
  • I am committed to fixing this in a reasonable amount of time, and responding promptly to feedback.

Expected Behavior

The authlogic/test_case.rb should be extended with the following includes:

module Authlogic
  module TestCase
    ...
  end

  ...

  # new includes
  ::Minitest::Unit::TestCase.send(:include, TestCase) if defined?(::Minitest::Unit::TestCase)
  ::Minitest::Test.send(:include, TestCase) if defined?(::Minitest::Test)
end

Actual Behavior

Tests fail because Minitest removed a legacy compatibility layer in v5.19.0 and test classes are no longer included.

@ceneon
Copy link

ceneon commented Mar 14, 2024

I'm having some trouble running tests on a Rails app that I'm upgrading from Rails 5 to Rails 7 and ended up here. Authlogic gets in between of some ActiveAdmin classes and breaks everything.

I thought these includes you propose may be missing, but I see them in Authlogic's code already -> https://github.com/binarylogic/authlogic/blame/master/lib/authlogic/test_case.rb#L213

@toncid
Copy link
Author

toncid commented Mar 15, 2024

Yes, the fix should be simple and something like:

module Authlogic
  ...

  if defined?(::Minitest)
    ::Minitest::Unit::TestCase.send(:include, TestCase) if defined?(::Minitest::Unit::TestCase)
    ::Minitest::Test.send(:include, TestCase) if defined?(::Minitest::Test)
  elsif defined?(::MiniTest) # for Minitest < 5.19.0
    ::MiniTest::Unit::TestCase.send(:include, TestCase) if defined?(::MiniTest::Unit::TestCase)
    ::MiniTest::Test.send(:include, TestCase) if defined?(::MiniTest::Test)
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants