Make resque job specs specific about what error should be raised; fix expectation on hoptoad notifier

This commit is contained in:
Raphael Sofaer 2011-08-10 16:36:42 -07:00
parent 091cdd6f94
commit 3431cd94fb

View file

@ -25,18 +25,19 @@ describe ResqueJobLogging do
end
it 'logs stack traces on failure' do
Rails.logger.should_receive(:info).with(/app_backtrace=/)
error = RuntimeError.new("GRAAAAAAAAAGH")
proc {
ResqueJobLoggingDummy.around_perform_log_job("stuff"){raise "GRAAAAAAAAAGH"}
}.should raise_error
ResqueJobLoggingDummy.around_perform_log_job("stuff"){raise error}
}.should raise_error(Regexp.new(error.message))
end
it 'notifies hoptoad if the hoptoad api key is set' do
Rails.logger.should_receive(:info)
AppConfig.should_receive(:[]).with(:hoptoad_api_key).and_return("what")
error = RuntimeError.new("GRAAAAAAAAAGH")
ResqueJobLoggingDummy.should_receive(:notify_hoptoad).with(error, ["stuff"], anything)
ResqueJobLoggingDummy.should_receive(:notify_hoptoad).with(error, ["stuff"])
proc {
ResqueJobLoggingDummy.around_perform_log_job("stuff"){raise error }
}.should raise_error
}.should raise_error(Regexp.new(error.message))
end
end