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 plugin,
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 can
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. What I
started with is below. Grasping at straws, I also tried current
ActiveSupport out of the picture by having the test inherit directly from
Test::Unit::TestCase and using the older "def test_truth; assert true; end"
syntax. But that didn't change anything. There are no errors; the tests just
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
# vendor/plugins/my_plugin/test/my_plugin_test.rb
require 'test_helper'
class MyPluginTest < ActiveSupport::TestCase
puts "In MyPluginTest file"
# Replace this with your real tests.
test "the truth" do
puts "In truth test"
assert true
end
end
# vendor/plugins/my_plugin/test/test_helper.rb
puts "vendor/plugins/my_plugin/test/test_helper is being read"
require 'rubygems'
require 'active_support'
require 'active_support/test_case'
$ rake test
(in /Users/xxx/rails/bar/vendor/plugins/my_plugin)
/usr/local/bin/ruby -I"lib:lib:test"
"/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
"test/my_plugin_test.rb"
vendor/plugins/my_plugin/test/test_helper is being read
In MyPluginTest file
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---