Test::Unit::TestCase refactoring

8 views
Skip to first unread message

Matt Jones

unread,
Nov 17, 2008, 1:31:38 PM11/17/08
to Ruby on Rails: Core
I noted that in b0ee1bdf2650d7a8380d4e9be58bba8d9c5bd40e and related
commits that
the extensions to TestCase are getting pulled out; what's the correct
thing to put into test/test_helper.rb?

--Matt Jones

Jeremy Kemper

unread,
Nov 17, 2008, 1:41:11 PM11/17/08
to rubyonra...@googlegroups.com

Use ActiveSupport::TestCase instead of Test::Unit::TestCase :)

jeremy

Matt Jones

unread,
Nov 17, 2008, 2:31:47 PM11/17/08
to rubyonra...@googlegroups.com
Are you sure? When I changed that (in test/test_helper.rb), none of
the test methods ran, and I
don't see any activity in the log.

Kevin Hall

unread,
Nov 17, 2008, 3:46:47 PM11/17/08
to rubyonra...@googlegroups.com
Just so you know, I have edge frozen from around five days ago and I
went through and replaced all Test::Unit::TestCase instances in my
test/ directory and all my tests still pass.

Matt Jones

unread,
Nov 17, 2008, 4:26:53 PM11/17/08
to rubyonra...@googlegroups.com
Found it - in activesupport/lib/active_support/test_case.rb, test/unit
needs to be required,
or the tests don't get run. Add "require 'test/unit'" after "rescue
LoadError".

--Matt

Jeremy Kemper

unread,
Nov 17, 2008, 4:39:50 PM11/17/08
to rubyonra...@googlegroups.com
On Mon, Nov 17, 2008 at 1:26 PM, Matt Jones <al2...@gmail.com> wrote:
> Found it - in activesupport/lib/active_support/test_case.rb, test/unit
> needs to be required,
> or the tests don't get run. Add "require 'test/unit'" after "rescue
> LoadError".

It's required in railties' test_help.

Otherwise, requiring 'active_support/test_case' will tests even if you
didn't mean to.

jeremy

Matt Jones

unread,
Nov 17, 2008, 5:03:37 PM11/17/08
to rubyonra...@googlegroups.com
The relevant line (from railties test_help.rb) was deleted in commit
582aa2ead58eacffca13e7efe94235958ee4db1b
on November 7 - should that be put back?

--Matt

Jeremy Kemper

unread,
Nov 17, 2008, 6:28:26 PM11/17/08
to rubyonra...@googlegroups.com
Yes; thanks: 5a4789e :)

jeremy
Reply all
Reply to author
Forward
0 new messages