jparker/minitest-redgreen

NoMethodError: undefined method external_encoding

Closed this issue · 2 comments

$ cat warning.rb
require 'minitest/autorun'
require 'minitest/redgreen'

class ProducesWarning < Minitest::Test
  def test_something
  end
end

puts "Ruby version: #{RUBY_VERSION}"
puts "Mintest version: #{Minitest::VERSION}"
puts "Mintest Redgreen version: #{Minitest::Redgreen::VERSION}"
$ ruby warning.rb
Ruby version: 2.2.3
Mintest version: 5.8.0
Mintest Redgreen version: 1.0
Run options: --seed 17815

# Running:

.

Finished in 0.000943s, 1060.1969 runs/s, 0.0000 assertions/s.
/Users/pete/.gem/ruby/2.2.3/gems/minitest-5.8.0/lib/minitest.rb:586:in `aggregated_results': undefined method `external_encoding' for #<Minitest::Redgreen:0x007fbc05174990 @io=#<IO:<STDOUT>>> (NoMethodError)
    from /Users/pete/.gem/ruby/2.2.3/gems/minitest-5.8.0/lib/minitest.rb:568:in `report'
    from /Users/pete/.gem/ruby/2.2.3/gems/minitest-5.8.0/lib/minitest.rb:640:in `each'
    from /Users/pete/.gem/ruby/2.2.3/gems/minitest-5.8.0/lib/minitest.rb:640:in `report'
    from /Users/pete/.gem/ruby/2.2.3/gems/minitest-5.8.0/lib/minitest.rb:134:in `run'
    from /Users/pete/.gem/ruby/2.2.3/gems/minitest-5.8.0/lib/minitest.rb:56:in `block in autorun'

I was having trouble reproducing this, but I think I've figured it out.

I only wrote this is a proof of concept, so I never bothered publishing it to RubyGems. It looks like the code was forked to https://github.com/kodemunki/minitest-redgreen, and that was published to RubyGems.

In practice, I've been using minitest-reporters which is being actively developed and is far more advanced. But if you really want to use this, you can lock your bundle to this repo — it seems to be working with the current version of Minitest (5.8).

gem 'minitest-redgreen', github: 'jparker/minitest-redgreen'

Aha, thanks @jparker.