Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8025745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:15:53+00:00 2026-06-04T23:15:53+00:00

I would like to try minitest with an existing Rails 2.3.14 application. I already

  • 0

I would like to try minitest with an existing Rails 2.3.14 application. I already tried several approaches but none of them seem to work.

It essentially boils down to this. When I add minitest to the Gemfile, all tests I run with bundle exec rake test are NOT executed with minitest.

The problem is that most of the test cases extend the ActiveSupport::Testcase or ActionController::Testcase (which extends ActiveSupport::TestCase).

By looking at the code of this class I saw that it already (somehow) suppports MiniTest:

class TestCase < ::Test::Unit::TestCase
    if defined? MiniTest
      Assertion = MiniTest::Assertion
      alias_method :method_name, :name if method_defined? :name
      alias_method :method_name, :__name__ if method_defined? :__name__
    else
...
end

(see https://github.com/rails/rails/blob/2-3-stable/activesupport/lib/active_support/test_case.rb for complete code)

My question here is:

Is it somehow possible to use minitest instead of test::unit in Rails 2.3 without having to extend (MiniTest::Unit::TestCase)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:15:55+00:00Added an answer on June 4, 2026 at 11:15 pm

    Any testing framework is made of two things, a way to define and run tests (call this the test runner) and an assertion framework.

    Looking at ActiveSupport it seems that if MiniTest is defined at all, running the rails Unit test runner will default to using MiniTest’s assertions classes. This means you get to use Minitest’s assertion syntax.

    Getting MiniTest defined should just be a case of requiring ‘minitest\unit’.

    However if you want to use the runners, then you need to derive from the MniTest framework test fixture base classes.

    There is a step by step walkthrough in railscasts for setting it up yourself.

    It boils down to:

    1. Remove test_unit from your config/applications.rb
    2. Add the minitest gem to your gem file “Gemfile”
    3. Setup the environment in a helper file you can include into your tests
    4. Add a rake task to run the tests. (/lib/tasks/minitest.rake)

    Railscasts has the details.

    If you don’t want to change your existing tests to do that.. then you have to monkey patch Test::Unit to redefine TestCase to either be the chosen MiniTest base class or something that derives from one. This is the approach that this gem takes and may give you some ideas on how best to go about that.

    The other solution is to do a search/replace through your code to switch the base classes of the test cases.

    I hope this helps.


    I Updated my answer and remove the following as out of date:

    minitest-rails has rightly been pointed out as it works for Rails 3.1 only.

    This gem seems to be old (26th March 2009) but it may help. Check the source code if you need hints to do something similar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to try out Capistrano to deploy a PHP application but can't
I would like to try Silex but i've some questions. I know to use
I would like to try programming genie , but I can't find neither source
I built a slideshow/decision-making game in Flash but would like to try to redo
I'm a pretty big noob to Java, but I would like try out htmlunit.
I am using maven to build application and I would like to try out
I have developed a small application that I would like to try and sell
I would like to try G-WAN but our server runs on RHEL5. I understood
I'm trying screwturn wiki, and it's pretty good, but I would like to try
I kind of new to kernel building but I would like to try my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.