This project is archived and is in readonly mode.
![Mathias Meyer Mathias Meyer](https://entp-lh-avatar-production.s3.amazonaws.com/avatars/20582/large.jpg?AWSAccessKeyId=AKIAJ4QBZRZBVMOUBNZA&Expires=2014341533&Signature=ob2ILabSYKqMKTSccZz4PzznkcQ%3D)
[PATCH] Plugin generator creates non-working Test class
Reported by Mathias Meyer | September 29th, 2008 @ 08:29 PM | in 2.x
The current plugin generator generates a test case that makes use of ActiveSupport's test method. But the generated test class is a subclass of Test::Unit::TestCase which doesn't have access to said method. So the tests fail out of the box.
My suggestion would be to change the generated code back to the old-style test method naming to generated a method like test_the_truth instead of test "the truth". The latter will only result in Kernel#test being called, which gives rather weird error messages.
The alternative would be to gem and require all the required ActiveSupport files, or to put the test method into a module and include it in Test::Unit::TestCase.
I wanted to put this up for discussion before doing anything about it.
Comments and changes to this ticket
-
Mathias Meyer October 1st, 2008 @ 04:17 PM
The attached patch introduces a test_helper that includes the required files, and makes the generated test cases subclass ActiveSupport::TestCase instead of Test::Unit::TestCase.
-
Mathias Meyer October 4th, 2008 @ 11:10 AM
- Title changed from Plugin generator creates non-working Test class to [PATCH] Plugin generator creates non-working Test class
-
Mathias Meyer October 5th, 2008 @ 06:53 PM
- Assigned user set to DHH
-
Repository October 30th, 2008 @ 11:58 AM
- State changed from new to committed
(from [7418d367f0ac4a4ac0ab4604c1b10db78efc6865]) Fixed plugin generator so that generated unit tests would subclass ActiveSupport::TestCase, also introduced a helper script to reduce the needed require statements. [#1137 state:committed]
Signed-off-by: David Heinemeier Hansson david@loudthinking.com http://github.com/rails/rails/co...
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
-
1137 [PATCH] Plugin generator creates non-working Test class (from [7418d367f0ac4a4ac0ab4604c1b10db78efc6865]) Fixed p...