Sha256: 3db6cd88ddea83b4e445485f38ddae01b996756bc7bac203a99984d3fdcdcb82

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

require "minitest/autorun"
require "hoe"

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

3 entries across 3 versions & 3 rubygems

Version Path
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/minitest-5.23.1/test/minitest/test_minitest_test_task.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/minitest-5.23.1/test/minitest/test_minitest_test_task.rb
minitest-5.22.3 test/minitest/test_minitest_test_task.rb