This project is archived and is in readonly mode.
a generated plugin's tests are not run by 'rake test'
Reported by Balint Erdi | February 4th, 2009 @ 11:08 PM | in 2.3.9
The test_helper.rb file generated for a plugin does not run the plugin's tests on 'rake test' (standing in the plugin's directory). That is very easy to verify:
- ./script/generate plugin my_plugin
- cd vendor/plugins/my_plugin
- rake test
No tests will be run. A "truth test" is generated by default so you should see ("1 tests, 1 assertions, 0 failures, 0 errors"). That's because test/unit is not required in the test_helper.rb file and the fix is just that, require it (see attached patch).
Comments and changes to this ticket
-
hiroshi February 22nd, 2009 @ 08:40 AM
I'v just stumbled upon the same problem with Rails 2.3.0 (RC1). I think this problem may discourages many authors of plugins from writing tests of their own plugins (, so possibly do I).
I wish this patch is merged before official release of 2.3.X and next version of 2.2.X.
-
Matt Jones March 14th, 2009 @ 09:12 PM
- Tag changed from 2.2.2, generators, patch, plugins to 2.3, generators, patch, plugins
I'll confirm that this is a problem, but the patch should swap the order that rubygems and test/unit are required, as miniunit gets pulled in from gems with "require 'test/unit'".
-
Balint Erdi March 15th, 2009 @ 12:22 AM
Right, I have not thought about that, thank you. Here goes the updated patch.
-
Jeremy Olliver March 15th, 2009 @ 01:37 AM
I think that the tests do run when just 'rake' is called, though you're quite right, that 'rake test' should run them as well. Tests all pass. I'm happy with this patch being added as is.
-
hiroshi June 15th, 2009 @ 08:15 AM
Every time I generate a plugin I waste a time googling words like "rails plugin test not run". I think this issue should be attended asap.
While this issue has been left months, a duplicated ticket #2248 is created. It also should be closed as "duplicated".
I hope this comment bump up the priority :)
-
hiroshi June 15th, 2009 @ 09:18 AM
I'v found when this issue happened from log of templates/test_helper.rb. It happened since release 2.2.1.
The commit:
http://github.com/rails/rails/commit/7418d367f0ac4a4ac0ab4604c1b10d...
The ticket having a patch which side effected this issue:
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets... -
dwaite July 11th, 2009 @ 05:10 PM
This patch fixes the issue for me, my tests now run. I'm somewhat surprised this issue has sat open for as long as it has.
-
dwaite July 11th, 2009 @ 05:38 PM
- Tag changed from 2.3, generators, patch, plugins to 2.3, generators, patch, plugins, verified
-
cnk July 28th, 2009 @ 01:06 AM
Please incorporate this small change into the stock plugin generator. It is a small fix for a puzzling bug.
-
CancelProfileIsBroken August 9th, 2009 @ 05:15 PM
- Tag changed from 2.3, generators, patch, plugins, verified to 2.3, generators, patch, plugins, verifiedbugmash
-
CancelProfileIsBroken August 9th, 2009 @ 05:15 PM
- Tag changed from 2.3, generators, patch, plugins, verifiedbugmash to 2.3, bugmash, generators, patch, plugins, verified
-
Nikolay Petrachkov August 9th, 2009 @ 05:54 PM
- Assigned user set to Pratik
"verified" patch by Balint Erdi "I've attached a patch." for master.
-
Repository August 9th, 2009 @ 05:59 PM
- State changed from new to resolved
(from [a1c289dbe44f32d30d3addcb6b9c912d153f93b0]) Require test/unit in the generated test_helper for plugin [#1878 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/a1c289dbe44f32d30d3addcb6b9c91... -
CancelProfileIsBroken August 9th, 2009 @ 06:54 PM
- Assigned user cleared.
- Tag changed from 2.3, bugmash, generators, patch, plugins, verified to 2.3, generators, patch, plugins, verified
- Milestone cleared.
-
Michel Pigassou July 2nd, 2010 @ 12:41 PM
- Importance changed from to
Was the patch include in versions up to 2.3.8?
It's the version of Rails I use and I have the same problem, however it's been marked as resolved in August 2009. -
Santiago Pastorino July 7th, 2010 @ 04:48 PM
- Assigned user set to José Valim
- State changed from resolved to open
- Milestone set to 2.3.9
-
José Valim July 8th, 2010 @ 10:16 PM
- State changed from open to committed
2-3-stable patch applied.
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
- 1878 a generated plugin's tests are not run by 'rake test' (from [a1c289dbe44f32d30d3addcb6b9c912d153f93b0]) Require...
- 2308 ActiveSupport/parameterize incorrectly assumes you have set $KCODE='u' I'm developing a plugin which uses the AS method paramete...
- 2248 Plugin Tests not Running You seem to paste a wrong url, the identical to this issu...
- 2248 Plugin Tests not Running Duplicate of #1878