Skip to content

Commit c41c9ca

Browse files
committed
Add a test for the hoptoad failure backend
This class did not have a test previously, it's about time it got one.
1 parent 295f5ab commit c41c9ca

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ gemspec
44

55
group :test do
66
gem "rack-test", "~> 0.5"
7+
gem "mocha", "~> 0.9.7"
78
end

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ GEM
1717
activesupport
1818
builder
1919
json (1.4.6)
20+
mocha (0.9.7)
21+
rake
2022
rack (1.2.2)
2123
rack-test (0.5.7)
2224
rack (>= 1.0)
25+
rake (0.8.7)
2326
redis (2.2.0)
2427
redis-namespace (0.10.0)
2528
redis (< 3.0.0)
@@ -34,5 +37,6 @@ PLATFORMS
3437
ruby
3538

3639
DEPENDENCIES
40+
mocha (~> 0.9.7)
3741
rack-test (~> 0.5)
3842
resque!

test/hoptoad_test.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require 'test_helper'
2+
require 'resque/failure/hoptoad'
3+
require 'mocha'
4+
require 'hoptoad_notifier'
5+
6+
context "Hoptoad" do
7+
8+
test "should be notified of an error" do
9+
exception = StandardError.new("BOOM")
10+
worker = Resque::Worker.new(:test)
11+
queue = "test"
12+
payload = {'class' => Object, 'args' => 66}
13+
14+
HoptoadNotifier.expects(:notify_or_ignore).with(
15+
exception,
16+
:parameters => {:payload_class => 'Object', :payload_args => '66'})
17+
18+
backend = Resque::Failure::Hoptoad.new(exception, worker, queue, payload)
19+
backend.save
20+
21+
end
22+
23+
end

0 commit comments

Comments
 (0)