Writing rails plugins

Hi *,
I’m trying to write a plugin to integrate my SSO server into my rails
app.
I’m finding the whole process quite difficult, I’m still blocked at
configuring rspec, and the lack of documentation is not helping.
I’ve put this inside my /vendor/plugins/foobar/spec/spec_helper.rb

ENV[“RAILS_ENV”] = “test”
require File.dirname(FILE) + “/…/…/…/…/config/environment”
require ‘spec’
require ‘spec/rails’

of course it will break up when I will package the plugin as a gem, the
path to the environment variable will be different.
My question is more about best practices I guess, I would like to know
how people includes rspec in a plugin that could be installed both
inside /vendor/plugins (useful also during development time) and as a
gem. I’ve seen some plugins (restful_authentication for example) provide
an --rspec option to write all specs directly into RAILS_ROOT/spec, but
it seems rather suboptimal, especially because plugins are not using
this with consistence.
Someone has any experience ?

TIA,
ngw

On Apr 16, 2010, at 8:15 AM, Nicholas W. wrote:

Hi *,
I’m trying to write a plugin to integrate my SSO server into my rails app.
I’m finding the whole process quite difficult, I’m still blocked at configuring rspec, and the lack of documentation is not helping.
I’ve put this inside my /vendor/plugins/foobar/spec/spec_helper.rb

I like garlic for testing plugins against (different) versions of rails:

Here’s a project that’s using it (for reference):

Scott