[rspec-users] Writing rails plugins

Nicholas Wieland nicholas.wieland at gmail.com
Fri Apr 16 08:15:38 EDT 2010

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 ?


More information about the rspec-users mailing list