Not sure whether or not you really want to use stub! vs.
should_receive here, do you really want to require that logger be
called or just allow it?
Good question. I think there are cases where I might want either or
both, depending on whether it’s for debugging or for support purposes.
Also if you want to set expectations on what’s actually logged you
might want to do
@log_stream = StringIO.new
controller.stub!(:logger) and_return(Logger.new(@logstream))
and then get at the log output via something like @log_stream.string
Great – that’s exactly what I need. Thank you.
Will.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.