[rspec-users] Writing rails plugins

Scott Taylor scott at railsnewbie.com
Fri Apr 16 14:54:42 EDT 2010


On Apr 16, 2010, at 8:15 AM, Nicholas Wieland 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:

http://github.com/ianwhite/garlic

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

http://github.com/markaby/markaby

Scott


> 
> 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
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100416/19916efe/attachment.html>


More information about the rspec-users mailing list