Hi, I'm Benedikt Deicke, and I'm a freelance web and software developer. I'm mainly building user focused web applications using Ruby on Rails and JavaScript. Additionally I'm currently studying for my master's degree and enjoying photography in my spare time. Feel free to get in touch with me, I'm available for hire!

August 25th, 2009
RSpec and Rails Helpers using the output buffer

When testing helper methods that use rails’ output buffer (for example by calling concat) with RSpec, be sure to add this to your specs:

   1  before(:each) do 
   2    helper.output_buffer = ""
   3  end

Took me a while to figure this one out. Apparently RSpec doesn’t initialize the output buffer and you end up with a NoMethodError on nil.

Posted by benediktFiled in Ruby on Rails
Bookmark and Share

Leave a comment