Skip to content

Commit

Permalink
Fix tests for ruby 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon de Andres committed Sep 1, 2016
1 parent d671767 commit 17ece23
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion spec/rollbar/plugins/delayed_job/job_data_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
require 'spec_helper'

require 'rollbar/plugins/delayed_job/job_data'
require 'delayed/backend/test'

# In delayed_job/lib/delayed/syck_ext.rb YAML.load_dj
# is broken cause it's defined as an instance method
# instead of module/class method. This is breaking
# the tests for ruby 1.8.7
if YAML.parser.class.name =~ /syck|yecht/i
module YAML
def self.load_dj(yaml)
# See https://github.com/dtao/safe_yaml
# When the method is there, we need to load our YAML like this...
respond_to?(:unsafe_load) ? load(yaml, :safe => false) : load(yaml)
end
end
end

describe Rollbar::Delayed::JobData do
describe '#to_hash' do
let(:handler) { { 'foo' => 'bar' } }
Expand Down

0 comments on commit 17ece23

Please sign in to comment.