Skip to content

Instantly share code, notes, and snippets.

View nicotaing's full-sized avatar
🥐

Nico Taing nicotaing

🥐
View GitHub Profile

Mocha/MiniTest integration

I think that the approach @tenderlove has suggested to avoid monkey-patching MiniTest (and the way MiniTest works) means that to use Mocha with MiniTest, you would either need to include the Mocha integration module into every test case, or define your own test case class inheriting from MiniTest::Unit::TestCase.

This works well for Rails (i.e. ActiveSupport), because it already defines a new test case class (ActiveSupport::TestCase) which is a suitable place to include the Mocha integration module.

If we were to go down this route, in non-Rails Ruby projects you'd need to do one of the following...

Option A