Skip to content

Commit b91bdb2

Browse files
committed
Fix test suite.
JRuby needs the new exception, but we don't always have JSON loaded.
1 parent 11d0212 commit b91bdb2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/resque_failure_redis_test.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
require 'test_helper'
22
require 'resque/failure/redis'
33

4+
unless defined?(JSON)
5+
module JSON
6+
class GeneratorError
7+
end
8+
end
9+
end
10+
411
context "Resque::Failure::Redis" do
512
setup do
613
@bad_string = [39, 250, 141, 168, 138, 191, 52, 211, 159, 86, 93, 95, 39].map { |c| c.chr }.join
@@ -13,7 +20,7 @@
1320

1421
test 'cleans up bad strings before saving the failure, in order to prevent errors on the resque UI' do
1522
# test assumption: the bad string should not be able to round trip though JSON
16-
assert_raises(MultiJson::DecodeError) {
23+
assert_raises(MultiJson::DecodeError, JSON::GeneratorError) {
1724
MultiJson.decode(MultiJson.encode(@bad_string))
1825
}
1926

0 commit comments

Comments
 (0)