Thanks Ho-Sheng, that helps.

I think I'm actually getting there, starting with the 
plugin_test_helper, but modifying it for Rspec, as you had done. It's 
not THAT hard, and maybe once I fully figure it out, I'll try to submit 
it back to plugin_test_helper. (I don't know how I couldn't find 
plugin_test_helper in my own googling, showing me that was incredibly 
valuable thanks!)

The one thing I'm still definitely still not getting to work right is 
auto-loading of classes. Maybe because "RAILS_ROOT" for the 
plugin_test_helper ends up being my_plugin/spec/app_helper -- but my 
classes are all in my_plugin/lib and my_plugin/app and such places.

Maybe I can get around this just by setting the Rails load_paths in my 
spec_helper.rb?  Does that make sense?  I wonder how the ordinary 
Test::Unit version of plugin_test_helper handles that, it seems like it 
would be a problem for it too?  [Just resetting RAILS_ROOT to be 
something else does NOT work, because of all the bootstrap code in 
my_plugin/spec/app_helper that is the whole point and DOES need to be in 
RAILS_ROOT].

What I'm doing:  My plugin actually DOESN'T use ActiveRecord (yet). In 
fact it doesn't use _very_ much of Rails at all, but does use a _bit_ 
here and there (a couple views you can use in your app if you like). 
But even without testing the Rails functionality, the lack of 
auto-loading immediately tripped me up. And then I realized that if I 
wanted to test the tiny bit of AR functionality that is in there, THAT 
was going to trip me up when I got to it.

And really, in general, I'm going to be writing several plug-ins. I want 
to figure out something that will Just Work for a Rails plugin, so I 
don't _need_ to think about _exactly_ what the dependencies are each 
time (and as the app changes), I can just set it up with a "Rails test 
environment" and write my tests, and go.  I need test running to be as 
easy as possible so I will actually write them. :)   So I think 
something based on plugin_test_helper, retrofitted for spec instead of 
Test::Unit, is indeed the key to that -- if I can just figure out the 
right way to get autoloading working!
-- 
Posted via http://www.ruby-forum.com/.

-- 
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.

Reply via email to