Skip to content

Commit

Permalink
Add a test for the hoptoad failure backend
Browse files Browse the repository at this point in the history
This class did not have a test previously, it's about time it got one.
  • Loading branch information
raykrueger committed May 11, 2011
1 parent 295f5ab commit c41c9ca
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -4,4 +4,5 @@ gemspec

group :test do
gem "rack-test", "~> 0.5"
gem "mocha", "~> 0.9.7"
end
4 changes: 4 additions & 0 deletions Gemfile.lock
Expand Up @@ -17,9 +17,12 @@ GEM
activesupport
builder
json (1.4.6)
mocha (0.9.7)
rake
rack (1.2.2)
rack-test (0.5.7)
rack (>= 1.0)
rake (0.8.7)
redis (2.2.0)
redis-namespace (0.10.0)
redis (< 3.0.0)
Expand All @@ -34,5 +37,6 @@ PLATFORMS
ruby

DEPENDENCIES
mocha (~> 0.9.7)
rack-test (~> 0.5)
resque!
23 changes: 23 additions & 0 deletions test/hoptoad_test.rb
@@ -0,0 +1,23 @@
require 'test_helper'
require 'resque/failure/hoptoad'
require 'mocha'
require 'hoptoad_notifier'

context "Hoptoad" do

test "should be notified of an error" do
exception = StandardError.new("BOOM")
worker = Resque::Worker.new(:test)
queue = "test"
payload = {'class' => Object, 'args' => 66}

HoptoadNotifier.expects(:notify_or_ignore).with(
exception,
:parameters => {:payload_class => 'Object', :payload_args => '66'})

backend = Resque::Failure::Hoptoad.new(exception, worker, queue, payload)
backend.save

end

end

0 comments on commit c41c9ca

Please sign in to comment.