I want to build a plugin by extracting some code from an existing app. I
figured the first thing I should do is get comfortable working on a
so I generated a Rails 2.3.3 app, and from inside that, I generated a
plugin. Before doing anything else, I thought I would try to run the
plugin’s generated test. The file loads fine - but the test isn’t run. I
prove that by adding a couple of “puts” statements to the test.
I can’t figure out why the file is found - but the test does not run.
started with is below. Grasping at straws, I also tried current
ActiveSupport out of the picture by having the test inherit directly
Test::Unit::TestCase and using the older “def test_truth; assert true;
syntax. But that didn’t change anything. There are no errors; the tests
get silently ignored. How can this be?
The steps I took:
$ rails generate bar
$ cd bar
$ script/generate plugin MyPlugin
$ cd vendor/plugin/my_plugin
$ rake test
RAILS version 2.3.3
Ruby 1.8.6 on MacOs X
class MyPluginTest < ActiveSupport::TestCase
puts “In MyPluginTest file”
Replace this with your real tests.
test “the truth” do
puts “In truth test”
puts “vendor/plugins/my_plugin/test/test_helper is being read”
$ rake test
vendor/plugins/my_plugin/test/test_helper is being read
In MyPluginTest file