Sha256: 8f48f7b1f05557382edc84eb03d313feb6feb21dbf44ddb48569f32be36038f9

Contents?: true

Size: 691 Bytes

Versions: 4

Compression:

Stored size: 691 Bytes

Contents

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:
    # <https://github.com/rails/rails/commit/ff0d5f14504f1aa29ad908ab15bab66b101427b7#diff-a071a1c8f51ce3b8bcb17ca59c79fc70>
    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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shoulda-context-2.0.0 lib/shoulda/context/rails_test_unit_reporter_patch.rb
shoulda-context-2.0.0.rc4 lib/shoulda/context/rails_test_unit_reporter_patch.rb
shoulda-context-2.0.0.rc3 lib/shoulda/context/rails_test_unit_reporter_patch.rb
shoulda-context-2.0.0.rc2 lib/shoulda/context/rails_test_unit_reporter_patch.rb