-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jon de Andres
committed
Oct 3, 2014
1 parent
9e545bd
commit 5332536
Showing
3 changed files
with
49 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'resque' | ||
|
||
module Rollbar | ||
module Delay | ||
class Resque | ||
def self.call(payload) | ||
new.call(payload) | ||
end | ||
|
||
def call(payload) | ||
::Resque.enqueue(Job, payload) | ||
end | ||
|
||
class Job | ||
def self.queue; 'default'; end | ||
|
||
def self.perform(payload) | ||
new.perform(payload) | ||
end | ||
|
||
def perform(payload) | ||
Rollbar.process_payload(payload) | ||
end | ||
end | ||
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
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,21 @@ | ||
require 'spec_helper' | ||
require 'rollbar/delay/resque' | ||
|
||
describe Rollbar::Delay::Resque do | ||
describe '.call' do | ||
let(:payload) do | ||
{ :key => 'value' } | ||
end | ||
|
||
before do | ||
allow(Resque).to receive(:inline?).and_return(true) | ||
end | ||
|
||
it 'process the payload' do | ||
loaded_hash = MultiJson.load(MultiJson.dump(payload)) | ||
|
||
expect(Rollbar).to receive(:process_payload).with(loaded_hash) | ||
described_class.call(payload) | ||
end | ||
end | ||
end |