[Rspec-devel] RSpec on Rails

Steven R. Baker srbaker at pobox.com
Thu Jun 1 13:16:58 EDT 2006


> Hi everyone,
> I've been working on an RSpec plugin for rails

Great, so have I.  You should look me up on irc (srbaker) so we can  
combine notes.

> Features:
> * minimal impact on RSpec - overwrites Spec::Runner::Context#run, adds
> to Context, Specification and ExecutionContext
> * pragmatic - only supports what I (and my contributor :) have  
> needed so far
> * mashes in rails' fixture loading - I only use yaml
> * mashes in rails' test controller setup
> * mashes in much of zenspider's Test::Rails::ControllerTestCase
> * can automatically load the Controller for verification.
> * many of rails' custom, crufty asserts aren't even needed with the
> beauty of "should"
> * provides rake tasks for running specs
> * uses the plugin install hook to create a spec directory, including
> the spec_helper required to use the rails features
> * its a plugin, so the barrier of using it in a rails app is very low.

I have rake integration, database loading, fixtures, etc.  We should  
discuss the best way to set up the environment for what Rails Tests  
use for controller loading.  Currently, the way functional tests are  
done in rails encourages (requires?) a 1:1 Class:Test, which is bad.

> AntiFeatures:
> * pragmatic - only supports what I (and my contributor :) have  
> needed so far
> * opportunistic - lots of snatch-n-grab code from Rails and Zenspider
> source. I blame the tightly coupled design of the original code, of
> course.

I have been pulling the code that I've been using from rails into a  
module that mixes in at run time.  This will get submitted as a patch  
back to rails, since Rails Testing, RSpec, and the RailsTest stuff  
use a lot of ti.

> However, it does bring RSpec to Rails. My recent apps have received a
> dose of RSpec goodness, and both I and the apps have benefitted
> immensely from the experience.
>
> Is anyone actively pimping RSpec? I've talked to fellow Rails/Ruby
> devs who've never heard of it!

A couple of us have been speaking at conferences and user groups on  
the subject.  The word is getting around well.

-Steven



More information about the Rspec-devel mailing list