diff --git a/lib/minitest/buildkite_collector_plugin.rb b/lib/minitest/buildkite_collector_plugin.rb index 0667473..0819078 100644 --- a/lib/minitest/buildkite_collector_plugin.rb +++ b/lib/minitest/buildkite_collector_plugin.rb @@ -1,6 +1,6 @@ module Minitest def self.plugin_buildkite_collector_init(options) - if Buildkite::TestCollector.respond_to?(:uploader) + if defined?(Buildkite::TestCollector::MinitestPlugin) && Buildkite::TestCollector.respond_to?(:uploader) self.reporter << Buildkite::TestCollector::MinitestPlugin::Reporter.new(options[:io], options) end end diff --git a/spec/test_collector/minitest_plugin/without_plugin_spec.rb b/spec/test_collector/minitest_plugin/without_plugin_spec.rb new file mode 100644 index 0000000..b87851e --- /dev/null +++ b/spec/test_collector/minitest_plugin/without_plugin_spec.rb @@ -0,0 +1,9 @@ +require "minitest" + +RSpec.describe "don’t break minitest when the plugin isn’t loaded" do + describe "running minitest" do + it "should not raise an error" do + expect { Minitest.run }.not_to raise_error + end + end +end