module Easymon
  class Testing
    def self.stub_check(name)
      Easymon.const_get("#{name.to_s.capitalize}Check").any_instance.stubs(:check)
    end

    def self.stub_service_success(name)
      stub_check(name).returns([true, "Up"])
    end

    def self.stub_service_failure(name)
      stub_check(name).returns([false, "Down"])
    end
  end
end

module Easymon
  module Testing
    extend self

    def stub_check(name)
      Easymon.const_get("#{name.to_s.capitalize}Check").any_instance.stubs(:check)
    end

    def stub_service_success(name)
      stub_check(name).returns([true, "Up"])
    end

    def stub_service_failure(name)
      stub_check(name).returns([false, "Down"])
    end
  end
end

Support using Easymon::Testing methods directly or by mixin
Support using Easymon::Testing methods directly or by mixin

Make `Easymon::Testing` a module instead of a class. Use the `extend self`
pattern to make its methods accessible directly, or by way of mixing in.

Direct use:

  Easymon::Testing.stub_check(:redis)

Mixed in:

  class MyTest < Minitest::Test
    include Easymon::Testing

    def test_something
      stub_check(:redis)
      # ...
    end
  end
