I am trying to test a controller in my rails app under a specific condition that should raise an error and log it. I got the raise test working great but I would like to make sure the logger gets called, so far I tried this, but it is not working
it 'logs the error' do
get 'edit', {:id => 'banana'}
Logger.any_instance.expects(:error)
end
ps i am using Mocha
I figured out exactly what I wanted, for example:
Is how you can use mocha to assert that a specific error message is being logged.