From 3431cd94fb3937feebcc61b5fe71f7637b2fbffe Mon Sep 17 00:00:00 2001 From: Raphael Sofaer <raphael@joindiaspora.com> Date: Wed, 10 Aug 2011 16:36:42 -0700 Subject: [PATCH] Make resque job specs specific about what error should be raised; fix expectation on hoptoad notifier --- spec/lib/resque_job_logging_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/lib/resque_job_logging_spec.rb b/spec/lib/resque_job_logging_spec.rb index a69f4fdcfe..16d12cd41f 100644 --- a/spec/lib/resque_job_logging_spec.rb +++ b/spec/lib/resque_job_logging_spec.rb @@ -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 -- GitLab