This project is archived and is in readonly mode.

#2519 new
Christos Zisopoulos

[PATCH] Requiring ActiveSupport::TestCase in a vanilla test fails to run the test case

Reported by Christos Zisopoulos | April 18th, 2009 @ 07:11 PM | in 3.x

It seems that because ActiveSupport::TestCase fails to require test/unit before requiring test/unit/testcase none of the test cases that inherit from ActiveSupport::TestCase are being run.

Normal Rails application tests that require test_helper, which in turn requires environment, don't exhibit this problem. This is possibly due to the fact that test/unit is required somewhere during Rails initialization.

I came across the issue when trying to run tests for a plugin created by Rails' own plugin generator which creates a test_helper which requires ActiveSupport::TestCase

The following won't execute any tests:

  # test_helper.rb
  require 'rubygems'
  require 'active_support'
  require 'active_support/test_case'

  # my_plugin_test.rb
  require 'test_helper'

  class MyPluginTest < ActiveSupport::TestCase
    test "the truth" do
      assert true

I am attaching the one-line patch which fixes it for me. I tried to figure a way to test that the test cases are run, but to be honest, I am lost. If anyone wants to point me to the right direction, I'll give it another try.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket