[rspec-users] issues with the trunk of rspec-rails

Nathan Wilmes nathan at pivotallabs.com
Tue Feb 10 15:02:20 EST 2009

Hi folks,

I'm currently in the process of upgrading an old Rails project to the Rails
2.2.2 and the trunk of RSpec, and ran into several issues with rspec-rails.
I've come up with workarounds for all of them, but I wanted to report them
to hopefully get them into better shape for other folks.

(1) config.include doesn't work on controller, helper, or view specs if no
:type parameter is required.

config.include sends an include to RailsExampleGroup.  Unfortunately, these
specs no longer extend RailsExampleGroup.  Here's my monkey patch:
module Spec
  module Runner
    class Configuration
      def get_type_from_options(options)
        options[:type] || options[:behaviour_type] || [:controller, :model,
:view, :helper, nil]

(2) The render override for RSpec controllers only takes one argument.  This
means that any controller using two argument forms will fail.

Our biggest use case for the two-argument controller form is this:  render
:update, :status => 404 do {}
This case is still allowable and not deprecated in Rails 2.2.2.

(3) with_tag is completely broken, as it tries to use the outer class as the
subject of 'with_tag', rather than the have_tag matcher that it lives

(4) assigns(:xxx) will give really bad errors if your class doesn't happen
to define == in such a way that it can equate to FalseClass.

Let me know if you'd like examples or extra explanation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090210/da0751f4/attachment-0001.html>

More information about the rspec-users mailing list