This is a refactor that should not affect any public facing methods. Handling different frameworks (or different versions of the same framework) was becoming messy really fast. The conditionals for each of them were scattered through the code. Thus, the solution was to use the strategy pattern (almost), and abstract the differences into what I called a runner. The different runners could not be injected into the initializer as a dependency, because at that point the testing framework is not yet loaded, which means there is no way of knowing what runner to use. So, it is lazy loaded, and only calculated when it is first used. Removed the main Runner class from the M module file, in order to make it simpler and easier to understand and reason about. The framework runner class now uses instance methods instead of class methods, mostly because of a personal preference, but also because I feel it instance methods are more flexible, and easier to change.
…eoljungberg-warning-free Conflicts: lib/m.rb test/minitest_test.rb test/options_test.rb
Uses Appraisal in order to test the different versions of minitest. The entire test suite will not run with minitest 5, since ruby relies on `Minitest::Unit::TestCase`, which was deprecated. Also, the previous solution was flawed since the `Minitest` constant was defined in minitest 4 as an alias to `MiniTest`, therefore I also check for the version number (`Minitest::Unit::VERSION`). I extracted the logic of checking which framework is loaded to a separate class, `M::Frameworks`, so it can be checked them on both the tests and the library code.
In the case of an empty test class similar to: class SomeTest < Test::Unit::TestCase end `m` was bombing out because `exit!` expects a non-nil value. The `Runner#run` method was only returning values in the case of tests that were found or tests not found within a file that does have tests. The third case of no tests at all was not being covered and would result in a `nil` being returned.
…urying that throughout the lib so M can be used from another library