When testing helper methods that use Rails’ output buffer (for example
by calling concat
) with RSpec, be sure to add this to your specs:
before (:each) do
helper.output_buffer = ""
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
.