Getting Started with Minitest
Installing Minitest itself is easy: do nothing.
Minitest is part of core Ruby, and the extensions weâll be covering here are part of core Rails.
A couple of add-on libraries weâve come across so far require specific installations for Minitest.
If we want the Capybara features weâve been using in our controller and feature tests, we do need to explicitly add a Minitest-Capybara adapter gem to our Gemfile:
â | gem â"minitest-rails-capybara"â, group: :test |
Minitestâs included test-double package, Minitest::Mock, is small and lacks some useful features. Weâll demonstrate test doubles using Mocha, which is the package the Rails team uses.
To install Mocha, place the following in the Gemfile:
â | gem ... |
Get Rails 4 Test Prescriptions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.