[rspec-devel] Monkey patch for Test::Rails with latest Edge Rails

David Chelimsky dchelimsky at gmail.com
Wed Nov 15 12:56:51 EST 2006

On 11/15/06, Trotter Cashion <trotter at eastmedia.com> wrote:
> Everyone,
> The latest version of Edge Rails raises an error when deprecated
> instance variables are set. Test::Rails touches @session when
> rendering views, causing specs to blow up. Put the monkey patch below
> into your spec_helper to fix this problem. I'm posting it on this
> list because I don't know when this will be patched in Test::Rails,
> and I figure some of you may run into this error soon.
> in spec/spec_helper.rb
> module Test
>    module Rails
>      class ViewTestCase < ViewTestCase.superclass
>        attr_reader :session
>        alias_method :setup_with_session_instance_variable, :setup
>        def setup
>          setup_with_session_instance_variable
>          @controller.send(:remove_instance_variable, "@session".to_sym)
>          @session = @controller.session
>        end
>      end
>    end
> end

Thanks Trotter.

Just an FYI to the list - I'm in the process of yanking the dependency
on ZenTest. We only use it to provide the separation and there is a
ton of other stuff like assertions and auditing that we don't want as
part of RSpec (different mentality), and it's going to be hard enough
to stay current w/ Rails, much less other libraries in the middle. So
we'll grab/learn what we need from Zen, include their license and call
it a day.

To be clear, this is not meant to be a dis on ZenTest. What it does is
awesome. It's just a very different approach from what we're trying to
encourage w/ rspec.


> - Trotter
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the rspec-devel mailing list