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

Trotter Cashion trotter at eastmedia.com
Wed Nov 15 12:25:56 EST 2006


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

- Trotter


More information about the rspec-devel mailing list