This post is part of a series of 31 Rails 4 articles being released each day in December 2012.
As of Ruby 1.9, MiniTest has replaced
Test::Unit as the testing framework included with the language. Since Rails 4 doesn't support Ruby 1.8, it allowed the team to use MiniTest in the framework moving forward.
As of Rails 4,
ActiveSupport::TestCase will now subclass
MiniTest::Spec, which provides a RSpec-style syntax and contexts to your tests.
RSpec Style Folder Structure
The biggest change being made to testing in Rails 4 is not the swapping of the testing framework, but the testing folder structure. The
test folder will have a structure very similar to RSpec:
Developers will no longer have to think about if the test is "functional" or a "unit". The structure provides a clear separation of where tests in your application should go.
If you are interested in learning more about what MiniTest has to offer, checkout the following resources: