Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rails tests fail in Ruby 1.9.1

#2145

This is because ActiveSupport::TestCase line 10 pulls in Test::Unit::TestCase. This file does not exist in Ruby 1.9.1.

Reproduce steps:


# Create skeleton
rails foobar
cd foobar
touch db/schema.rb

# Put this in test/unit/foo_test.rb:
require File.dirname(__FILE__) << '/../test_helper'

class FooTest < ActiveSupport::TestCase
        def test_true
                assert true
        end
end

# Run the fake test
ruby191 /usr/bin/rake

You should see a MissingSourceFile error.

Reported by Mike Perham · March 5th, 2009 @ 11:34 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Niels Ganser
    Niels Ganser

    Test::Unit is not included in Ruby 1.9 any longer but

    sudo gem191 install test-unit

    should do the trick. Thus this ticket should IMHO be set to wontfix

    March 6th, 2009 @ 02:15 PM

  2. Mike Perham
    Mike Perham

    Then the fix is to include test-unit as a gem dependency. Rails should not be creating test infrastructure that does not work out of the box with Ruby 1.9.

    March 6th, 2009 @ 03:40 PM

  3. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)
    • State changed from new to wontfix

    Since Rails 2.3, unit testing should be done using ActiveSupport::TestCase instead. You can confirm this behavior by generate a model, and you would see that unit testing inherits from ActiveSupport::TestCase now.

    If you still need test-unit, then you will need to install the gem.

    January 20th, 2010 @ 05:35 PM