Skip to content

Commit

Permalink
Added unit test to ensure that we can provide our own jid.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Lecocq committed May 15, 2012
1 parent 31d4a35 commit 9ced46d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/qless/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def heartbeat=(value)
# => delay (int)
def put(klass, data, opts={})
@client._put.call([@name], [
Qless.generate_jid,
(opts[:jid] or Qless.generate_jid),
klass.to_s,
JSON.generate(data),
Time.now.to_f,
Expand All @@ -86,7 +86,7 @@ def recur(klass, data, interval, opts={})
@client._recur.call([], [
'on',
@name,
Qless.generate_jid,
(opts[:jid] or Qless.generate_jid),
klass.to_s,
JSON.generate(data),
Time.now.to_f,
Expand Down
7 changes: 7 additions & 0 deletions spec/unit/queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ module Qless
string.should include("queue-name")
end
end

it "can specify a jid in put and recur" do
client.queues['foo'].put( Qless::Job, {'foo' => 'bar'}, :jid => 'howdy').should eq('howdy')
client.queues['foo'].recur(Qless::Job, {'foo' => 'bar'}, 5, :jid => 'hello').should eq('hello')
client.jobs['howdy'].should be
client.jobs['hello'].should be
end
end
end

0 comments on commit 9ced46d

Please sign in to comment.