Sha256: 7fa40d9394b7ac16b74c295ca6031bb5d765d37f68c3d3abb15e9bd9f83cfb45

Contents?: true

Size: 2 KB

Versions: 32

Compression:

Stored size: 2 KB

Contents

require_relative "../../test_helper"
require "minitest/mock"

module MinitestReportersTest
  class ReportersTest < Minitest::Test
    def test_chooses_the_rubymine_reporter_when_necessary
      # Rubymine reporter complains when RubyMine libs are not available, so
      # stub its #puts method out.
      $stdout.stub :puts, nil do
        reporters = Minitest::Reporters.choose_reporters [], { "RM_INFO" => "x" }
        assert_instance_of Minitest::Reporters::RubyMineReporter, reporters[0]

        reporters = Minitest::Reporters.choose_reporters [], { "TEAMCITY_VERSION" => "x" }
        assert_instance_of Minitest::Reporters::RubyMineReporter, reporters[0]
      end
    end

    def test_chooses_the_textmate_reporter_when_necessary
      reporters = Minitest::Reporters.choose_reporters [], {"TM_PID" => "x"}
      assert_instance_of Minitest::Reporters::RubyMateReporter, reporters[0]
    end

    def test_chooses_the_console_reporters_when_necessary
      reporters = Minitest::Reporters.choose_reporters [Minitest::Reporters::SpecReporter.new], {}
      assert_instance_of Minitest::Reporters::SpecReporter, reporters[0]
    end

    def test_chooses_no_reporters_when_running_under_vim
      reporters = Minitest::Reporters.choose_reporters(
        [Minitest::Reporters::DefaultReporter.new], { "VIM" => "/usr/share/vim" })
      assert_nil reporters
    end

    def test_uses_minitest_clock_time_when_minitest_version_greater_than_561
      Minitest::Reporters.stub :minitest_version, 583 do
        Minitest.stub :clock_time, 6765.378751009 do
          clock_time = Minitest::Reporters.clock_time
          assert_equal 6765.378751009, clock_time
        end
      end
    end

    def test_uses_minitest_clock_time_when_minitest_version_less_than_561
      Minitest::Reporters.stub :minitest_version, 431 do
        Time.stub :now, Time.new(2015, 11, 20, 17, 35) do
          clock_time = Minitest::Reporters.clock_time
          assert_equal Time.new(2015, 11, 20, 17, 35), clock_time
        end
      end
    end
  end
end

Version data entries

32 entries across 25 versions & 8 rubygems

Version Path
josufst_palindrome-0.2.0 vendor/cache/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
josufst_palindrome-0.2.0 vendor/cache/ruby/2.6.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
josufst_palindrome-0.1.1 vendor/cache/ruby/2.6.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
josufst_palindrome-0.1.1 vendor/cache/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
hirohig_palindrome-0.2.0 vendor/bundle/ruby/2.6.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
hirohig_palindrome-0.1.0 vendor/bundle/ruby/2.6.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
cspeezy_palindrome-0.3.0 path/ruby/2.6.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
cspeezy_palindrome-0.2.0 path/ruby/2.6.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
cspeezy_palindrome-0.1.0 path/ruby/2.6.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
steenfest_palindrome-0.1.2 ruby/2.5/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
steenfest_palindrome-0.1.1b ruby/2.5/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
dmurphy_palindrome-0.1.0 vendor/cache/ruby/2.3.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
dmurphy_palindrome-0.1.0 vendor/cache/ruby/2.3.0/gems/dmurphy_palindrome-0.1.0/vendor/cache/ruby/2.3.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/lgrgic_palindrome_detector-0.1.0/vendor/cache/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
lgrgic_palindrome_detector-0.1.0 vendor/cache/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/minitest-reporters-1.2.0/test/unit/minitest/reporters_test.rb