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

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