Fix and cleanup tests (fixes #164)

Fix the seemingly random test failures (see issue #164) by locking down the minitest version for now and update the tests to use the minitest 5.x API.

Also does some test clean-up to stop loads of files from being left hanging around after tests have been run and stops using deprecated API calls for later versions of ruby.