Skip to content

Commit 6721274

Browse files
committed
Merge pull request resque#681 from jeremy/yagni-mocha
Consolidate Thoughtbot-backed Failure tests and eliminate Mocha dependency
2 parents b3ea3c4 + 02dbca4 commit 6721274

File tree

5 files changed

+27
-56
lines changed

5 files changed

+27
-56
lines changed

Gemfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ end
1414

1515
group :test do
1616
gem "rack-test", "~> 0.5"
17-
gem "mocha", "~> 0.9.7"
1817
gem "yajl-ruby", "~>0.8.2", :platforms => :mri
1918
gem "json", "~>1.5.3", :platforms => [:jruby, :rbx]
20-
gem "hoptoad_notifier"
21-
gem "airbrake"
2219
gem "i18n"
2320
gem "minitest"
2421
end

test/airbrake_test.rb

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/hoptoad_test.rb

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/test_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
$dir = File.dirname(File.expand_path(__FILE__))
66
$LOAD_PATH.unshift $dir + '/../lib'
77
$TESTING = true
8-
require 'mocha'
98
require 'minitest/unit'
109
require 'minitest/spec'
1110
require 'test/unit'

test/thoughtbot_failure_test.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
require 'test_helper'
2+
require 'minitest/mock'
3+
4+
require 'resque/failure/thoughtbot'
5+
6+
class ThoughtbotFailure < Resque::Failure::Base
7+
include Resque::Failure::Thoughtbot
8+
end
9+
10+
describe "Hoptoad and Airbrake failure class" do
11+
it "should be notified of an error" do
12+
exception = StandardError.new("BOOM")
13+
worker = Resque::Worker.new(:test)
14+
queue = "test"
15+
payload = {'class' => Object, 'args' => 66}
16+
17+
mock = Minitest::Mock.new
18+
mock.expect :notify_or_ignore, nil, [ exception,
19+
{ :parameters => { :payload_class => 'Object', :payload_args => '66' }} ]
20+
ThoughtbotFailure.klass = mock
21+
22+
backend = ThoughtbotFailure.new(exception, worker, queue, payload)
23+
backend.save
24+
25+
mock.verify
26+
end
27+
end

0 commit comments

Comments
 (0)