From 36d5c380ead406d48587bdbfdc9d8b06a4efce9c Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Sat, 2 Mar 2024 17:13:14 +0100 Subject: [PATCH] Fix a method redefinition warning (#94) The fix in rails was added somewhere in 5.X, #82 dropped support for rails 5.2, so just drop the workaround as well. ``` /usr/local/bundle/gems/shoulda-context-2.0.0/lib/shoulda/context/rails_test_unit_reporter_patch.rb:8: warning: method redefined; discarding old format_rerun_snippet /usr/local/bundle/gems/railties-7.1.3/lib/rails/test_unit/reporter.rb:76: warning: previous definition of format_rerun_snippet was here ``` --- lib/shoulda/context.rb | 1 - .../context/rails_test_unit_reporter_patch.rb | 21 ------------------- 2 files changed, 22 deletions(-) delete mode 100644 lib/shoulda/context/rails_test_unit_reporter_patch.rb diff --git a/lib/shoulda/context.rb b/lib/shoulda/context.rb index 86f9b601..d3ad1079 100644 --- a/lib/shoulda/context.rb +++ b/lib/shoulda/context.rb @@ -9,7 +9,6 @@ if defined?(Rails) require "shoulda/context/railtie" - require "shoulda/context/rails_test_unit_reporter_patch" end Shoulda::Context.configure do |config| diff --git a/lib/shoulda/context/rails_test_unit_reporter_patch.rb b/lib/shoulda/context/rails_test_unit_reporter_patch.rb deleted file mode 100644 index f45dd1e7..00000000 --- a/lib/shoulda/context/rails_test_unit_reporter_patch.rb +++ /dev/null @@ -1,21 +0,0 @@ -begin - require "rails/test_unit/reporter" - - Rails::TestUnitReporter.class_eval do - # Fix #format_rerun_snippet so that it works with recent versions of Minitest. - # This was cribbed from: - # - def format_rerun_snippet(result) - location, line = - if result.respond_to?(:source_location) - result.source_location - else - result.method(result.name).source_location - end - - "#{executable} #{relative_path_for(location)}:#{line}" - end - end -rescue LoadError - # Rails::TestUnitReporter was introduced in Rails 5 -end