[rspec-users] Rails Rendering diagnostics.rhtml in Controller Spec

Ryan Bates bates.ryan at gmail.com
Wed May 23 18:21:20 EDT 2007


I got it working by placing this in the spec_helper.rb:

---
Spec::Runner.configure do |config|
  config.before(:each) do
    unless @controller_class_name.blank?
      @controller_class_name.constantize.class_eval do
        define_method :rescue_action do |e|
          raise e
        end
      end
    end
  end
end
---

I'm sure accessing the @controller_class_name instance variable
directly like that isn't a good thing, but it seems to work. If anyone
knows of a better way please reply. :)

Thanks again,

Ryan


More information about the rspec-users mailing list