when-do 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d239b9c341f86627431530ca699c631c239eddb1
4
- data.tar.gz: 5cdd7489b259bc86dfa76de4910c54df1c7b7e42
3
+ metadata.gz: 823bf5e4c5e652b195b5a598e7e75d174c6e5d81
4
+ data.tar.gz: 5a5f48e50a3b780fccc2cec0ac21c3a6e81caebe
5
5
  SHA512:
6
- metadata.gz: bb8a96457d0f7e4d60103e9b4f6e3f2b78727e31224802f7b39c6b0c93ef046673cfcd1a36b085650e145e6177c7b0d05d3ae3f5be71328e19904a912191399f
7
- data.tar.gz: c364fc711079505331c5be0668b90e2875998ab823ee7052a9f66813cb6921b0fce3caa353b838c3ca1e903304001599afecc6fc6980c48499963c8372f52c0a
6
+ metadata.gz: aac68b37884437c3863e872d593ac6b7c78d941eb31e88b0e3d6135a1e12db3de0a61aee0d699d0000a36dda76505724afb81bf4bda22ddb5b2f1a112c92349f
7
+ data.tar.gz: 089a112f402f90328a150c1d00168314abfd0e694293c399e8ffe382fe1a05e19571f55aa657f9f0f1bc1814262537b9809db610fc86f2f272ff47ec98940c84
@@ -1,3 +1,3 @@
1
1
  module When
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
data/lib/when-do.rb CHANGED
@@ -67,7 +67,8 @@ module When
67
67
  def self.enqueue(klass, args: [], worker_args: {})
68
68
  validate_args(args)
69
69
  job = worker_args.merge('jid' => SecureRandom.uuid, 'class' => klass.to_s, 'args' => args)
70
- if redis.lpush(worker_queue_key, job.to_json) > 0
70
+ wqk = job[:queue] || job['queue'] || worker_queue_key
71
+ if redis.lpush(wqk, job.to_json) > 0
71
72
  job['jid']
72
73
  else
73
74
  msg = "Failed to enqueue #{job}."
@@ -141,5 +141,15 @@ describe When do
141
141
  }.to raise_error When::InvalidArgs
142
142
  end
143
143
  end
144
+
145
+ context 'enqueueing to a specific queue' do
146
+ let(:specific_queue) { 'a_specific_queue' }
147
+
148
+ it 'adds an itme to the specific queue' do
149
+ expect { When.enqueue(klass, worker_args: { queue: specific_queue }) }
150
+ .to change { redis.llen(specific_queue) }
151
+ .from(0).to(1)
152
+ end
153
+ end
144
154
  end
145
155
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: when-do
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-23 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: when-cron