Sha256: cb652e4a3e22eaee5856265623568cd34a4e8160416821b7d86d267844a85f33

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

require "minitest/autorun"

begin
  require "hoe"
rescue LoadError => e
  warn e.message
  return
end

require "minitest/test_task"

Hoe.load_plugins # make sure Hoe::Test is loaded

class TestHoeTest < Minitest::Test
  PATH = "test/minitest/test_minitest_test_task.rb"

  mt_path = %w[lib test .].join File::PATH_SEPARATOR

  MT_EXPECTED = %W[-I#{mt_path} -w
                   -e '%srequire "#{PATH}"'
                   --].join(" ") + " "

  def test_make_test_cmd_for_minitest
    skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]

    require "minitest/test_task"

    framework = %(require "minitest/autorun"; )

    @tester = Minitest::TestTask.create :test do |t|
      t.test_globs = [PATH]
    end

    assert_equal MT_EXPECTED % [framework].join("; "), @tester.make_test_cmd
      .sub(/ -- .+/, " -- ")
  end

  def test_make_test_cmd_for_minitest_prelude
    skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]

    require "minitest/test_task"

    prelude = %(require "other/file")
    framework = %(require "minitest/autorun"; )

    @tester = Minitest::TestTask.create :test do |t|
      t.test_prelude = prelude
      t.test_globs = [PATH]
    end

    assert_equal MT_EXPECTED % [prelude, framework].join("; "), @tester.make_test_cmd
      .sub(/ -- .+/, " -- ")
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/minitest-5.24.1/test/minitest/test_minitest_test_task.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/minitest-5.24.1/test/minitest/test_minitest_test_task.rb
minitest-5.24.1 test/minitest/test_minitest_test_task.rb
minitest-5.24.0 test/minitest/test_minitest_test_task.rb