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

David Chelimsky dchelimsky at gmail.com
Tue Feb 10 23:49:12 EST 2009


On Tue, Feb 10, 2009 at 2:02 PM, Nathan Wilmes <nathan at pivotallabs.com> wrote:
> 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.

What are they extending? Are they a custom class? You can resolve this
by making your custom class the default:

Spec::Example::ExampleGroupFactory.default(MyCustomBaseExampleGroupClass)

> 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]
>       end
>     end
>   end
> end
>
> (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.

I can reinstate the extra arg. Are you looking for it to be handled in
some way? Or just to not blow up?

> (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
> inside.

Was it working before and the upgrade broke existing specs? Or is this
a general observation?

> (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.

Can you provide an example?

>
> Let me know if you'd like examples or extra explanation.

Thanks for the insights thus far.

Cheers,
David

> =N
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list