-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send correct hash value for delayed job 'handler' object.
It'll be useful for users send a Hash object there instead sending a YAML string.
- Loading branch information
Jon de Andres
committed
Sep 15, 2015
1 parent
fd86fbc
commit cd2c994
Showing
3 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'spec_helper' | ||
|
||
require 'rollbar/delayed_job' | ||
require 'delayed/backend/test' | ||
|
||
describe Rollbar::Delayed::JobData do | ||
describe '#to_hash' do | ||
let(:handler) { { 'foo' => 'bar' } } | ||
|
||
let(:attrs) do | ||
{ | ||
'id' => 1, | ||
'priority' => 0, | ||
'attempts' => 1, | ||
'handler' => handler.to_yaml | ||
} | ||
end | ||
|
||
let(:job) do | ||
::Delayed::Backend::Test::Job.new(attrs) | ||
end | ||
|
||
subject { described_class.new(job) } | ||
|
||
it 'returns the correct job data' do | ||
expected_result = attrs.dup | ||
expected_result.delete('id') | ||
expected_result['handler'] = handler | ||
|
||
result = subject.to_hash | ||
|
||
expect(result).to be_eql(expected_result) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters