sidekiq-apriori 0.0.3 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afd46659ed78b4be97a6a3a3fb2fa6abce7c1818
4
- data.tar.gz: aef21efe430abb2fabafeaef22cf333e2ce1f63c
3
+ metadata.gz: 8520828e777c87ddf510b8c80f6f5eaab0dcb80a
4
+ data.tar.gz: 66cd361fcb7de9e529b06db5b077eb4f26604a3f
5
5
  SHA512:
6
- metadata.gz: bb4148906994f507b4b7064b0a5a6e3eab2d48305bf9479b08802751cbed4745ee90bab92f2690f3bc32a34ca1c950607385181c55fab50e022e0b500ed249d1
7
- data.tar.gz: 4dcdc931bc462cd284e7c8e5a1cf90711546c5e72d062fe3e86490fd5c5b39de35944c9a9dea098278af1d685a7554b38e98e78ca68465d2aceb9a34050dd449
6
+ metadata.gz: 1ddf4dd4d818c4197adc3f94f7e4983d449b16bf67b2bbcc8dac35cd6bc5276e72cc197a07153e7a29de92ca74fbbfad48da52b77ffa709ecdcac13781df2f7f
7
+ data.tar.gz: 95681152f904ea6a1711d7cbf8a1df9db5f3377a12bdd119aabd9bae964ba76698b4298fe03d84881fd496f68c4ec52b3684180df4532346ca6bf8ae589f98eb
@@ -1,4 +1,8 @@
1
1
  language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 1.9.3
2
+
3
+ matrix:
4
+ include:
5
+ - rvm: 2.0.0
6
+ gemfile: gemfiles/ruby_2.gemfile
7
+ - rvm: 1.9.3
8
+ gemfile: gemfiles/ruby_19.gemfile
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
  gemspec
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "sidekiq", "< 3.2"
4
+
5
+ gemspec :path=>"../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "sidekiq", ">= 3.2"
4
+
5
+ gemspec :path=>"../"
@@ -2,7 +2,7 @@ require 'sidekiq-apriori/priorities'
2
2
 
3
3
  module Sidekiq::Apriori
4
4
  class Prioritizer
5
- def call(worker, msg, queue)
5
+ def call(worker, msg, queue, redis_pool = nil)
6
6
  options = msg["args"].last if msg["args"].respond_to?(:last)
7
7
  priority = options[:priority] if options.is_a?(Hash) && options.has_key?(:priority)
8
8
 
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Apriori
3
- VERSION = "0.0.3"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency "fakeredis"
25
25
  s.add_development_dependency "pry"
26
26
  s.add_development_dependency "rake"
27
- s.add_development_dependency "rspec"
27
+ s.add_development_dependency "rspec", "~>3.0"
28
28
  s.add_development_dependency "simplecov"
29
29
  s.add_development_dependency "simplecov-rcov"
30
30
  s.add_development_dependency "sqlite3"
@@ -12,21 +12,21 @@ describe Sidekiq::Apriori::Arb do
12
12
 
13
13
  it "should validate priorities" do
14
14
  arb.priority = "none"
15
- arb.should be_invalid
15
+ expect(arb).to be_invalid
16
16
 
17
17
  Sidekiq::Apriori::PRIORITIES.each do |priority|
18
18
  arb.priority = priority
19
- arb.should be_valid
19
+ expect(arb).to be_valid
20
20
  end
21
21
  end
22
22
 
23
23
  it "should attempt prioritization on creation with named prioritizer" do
24
- using_method.should_receive(:some_method)
24
+ expect(using_method).to receive(:some_method)
25
25
  using_method.save
26
26
  end
27
27
 
28
28
  it "should attempt prioritization on creation with using a block" do
29
- using_callable.should_receive(:some_other_method)
29
+ expect(using_callable).to receive(:some_other_method)
30
30
  using_callable.save
31
31
  end
32
32
  end
@@ -3,7 +3,7 @@ require 'sidekiq-apriori/middleware/prioritizer'
3
3
 
4
4
  describe Sidekiq::Apriori, 'client middleware' do
5
5
  before do
6
- Sidekiq.stub(:server? => false)
6
+ allow(Sidekiq).to receive(:server?).and_return(false)
7
7
 
8
8
  Sidekiq.configure_client do |config|
9
9
  config.client_middleware do |chain|
@@ -14,12 +14,13 @@ describe Sidekiq::Apriori, 'client middleware' do
14
14
  end
15
15
 
16
16
  it "should include Sidekiq::Apriori::Prioritizer in client middleware" do
17
- Sidekiq.client_middleware.entries.should be_empty
17
+ expect(Sidekiq.client_middleware.entries).to be_empty
18
18
 
19
- (require 'sidekiq-apriori/middleware/client').should be_true
19
+ expect(require 'sidekiq-apriori/middleware/client').to eq(true)
20
20
 
21
- Sidekiq.client_middleware.entries.should_not be_empty
22
- Sidekiq.client_middleware.entries.map(&:klass).
23
- should be_include(Sidekiq::Apriori::Prioritizer)
21
+ expect(Sidekiq.client_middleware.entries).not_to be_empty
22
+ expect(Sidekiq.client_middleware.entries.map(&:klass)).to(
23
+ include(Sidekiq::Apriori::Prioritizer)
24
+ )
24
25
  end
25
26
  end
@@ -9,26 +9,36 @@ describe Sidekiq::Apriori::Prioritizer do
9
9
 
10
10
  describe '#call' do
11
11
  it 'should respond' do
12
- middleware.respond_to?(:call).should be_true
12
+ expect(middleware).to respond_to(:call)
13
13
  end
14
14
 
15
- it 'should require three arguments' do
15
+ it 'rejects less than three arguments' do
16
16
  expect { middleware.call }.
17
- to raise_error( ArgumentError,'wrong number of arguments (0 for 3)')
17
+ to raise_error( ArgumentError, /wrong number of arguments/ )
18
+ end
19
+
20
+ it 'allows 3 arguments' do
21
+ expect { middleware.call(nil, message, queue) {} }.
22
+ not_to raise_error
23
+ end
24
+
25
+ it 'allows for 4 arguments' do
26
+ expect { middleware.call(nil, message, queue, nil) {} }.
27
+ not_to raise_error
18
28
  end
19
29
 
20
30
  it 'should set priority queue' do
21
31
  middleware.call(nil, message, queue) {}
22
- message['queue'].should eql('foo_high')
32
+ expect(message['queue']).to eq('foo_high')
23
33
  end
24
34
 
25
35
  it 'should allow only one priority suffix' do
26
36
  message['queue'] = 'foo_low_high_immediate'
27
37
  middleware.call(nil, message, queue) {}
28
- message['queue'].should eql('foo_high')
38
+ expect(message['queue']).to eq('foo_high')
29
39
 
30
40
  middleware.call(nil, message, queue) {}
31
- message['queue'].should eql('foo_high')
41
+ expect(message['queue']).to eq('foo_high')
32
42
  end
33
43
  end
34
44
  end
@@ -3,7 +3,7 @@ require 'sidekiq-apriori/middleware/prioritizer'
3
3
 
4
4
  describe Sidekiq::Apriori, 'server middleware' do
5
5
  before do
6
- Sidekiq.stub(:server? => true)
6
+ allow(Sidekiq).to receive(:server?).and_return(true)
7
7
 
8
8
  Sidekiq.configure_server do |config|
9
9
  config.client_middleware do |chain|
@@ -14,12 +14,13 @@ describe Sidekiq::Apriori, 'server middleware' do
14
14
  end
15
15
 
16
16
  it "should include Sidekiq::Apriori::Prioritizer in client middleware" do
17
- Sidekiq.client_middleware.entries.should be_empty
17
+ expect(Sidekiq.client_middleware.entries).to be_empty
18
18
 
19
- (require 'sidekiq-apriori/middleware/server').should be_true
19
+ expect(require 'sidekiq-apriori/middleware/server').to eq(true)
20
20
 
21
- Sidekiq.client_middleware.entries.should_not be_empty
22
- Sidekiq.client_middleware.entries.map(&:klass).
23
- should be_include(Sidekiq::Apriori::Prioritizer)
21
+ expect(Sidekiq.client_middleware.entries).not_to be_empty
22
+ expect(Sidekiq.client_middleware.entries.map(&:klass)).to(
23
+ include(Sidekiq::Apriori::Prioritizer)
24
+ )
24
25
  end
25
26
  end
@@ -15,7 +15,7 @@ describe Sidekiq::Apriori::Worker do
15
15
  #
16
16
  if ( RUBY_VERSION.split(/\./).map(&:to_i) rescue [] ).first > 1
17
17
  it "redefines 'perform' to handle an extra argument when that argument has priority information" do
18
- job.should be_an_instance_of(Job)
18
+ expect(job).to be_an_instance_of(Job)
19
19
  expect { job.perform(priority: "high") }.not_to raise_error
20
20
  end
21
21
 
@@ -23,7 +23,7 @@ Sidekiq.configure_server do |config|
23
23
  end
24
24
 
25
25
  RSpec.configure do |config|
26
- config.before(:each) do
26
+ config.before(:each) do |example|
27
27
  ## Use metadata to determine testing behavior
28
28
  ## for queuing.
29
29
  Sidekiq::Worker.clear_all
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-apriori
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Thomas
@@ -9,132 +9,132 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-01 00:00:00.000000000 Z
12
+ date: 2015-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: fakeredis
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: pry
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
76
+ version: '3.0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0'
83
+ version: '3.0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: simplecov
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: simplecov-rcov
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: sqlite3
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - '>='
123
+ - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: sidekiq
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>='
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - '>='
137
+ - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  description: Prioritization middleware for Sidekiq
@@ -144,15 +144,17 @@ executables: []
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
- - .gitignore
148
- - .rspec
149
- - .ruby-version
150
- - .simplecov
151
- - .travis.yml
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - ".ruby-version"
150
+ - ".simplecov"
151
+ - ".travis.yml"
152
152
  - Gemfile
153
153
  - LICENSE
154
154
  - README.md
155
155
  - Rakefile
156
+ - gemfiles/ruby_19.gemfile
157
+ - gemfiles/ruby_2.gemfile
156
158
  - lib/sidekiq-apriori.rb
157
159
  - lib/sidekiq-apriori/arb.rb
158
160
  - lib/sidekiq-apriori/middleware.rb
@@ -180,17 +182,17 @@ require_paths:
180
182
  - lib
181
183
  required_ruby_version: !ruby/object:Gem::Requirement
182
184
  requirements:
183
- - - '>='
185
+ - - ">="
184
186
  - !ruby/object:Gem::Version
185
187
  version: '0'
186
188
  required_rubygems_version: !ruby/object:Gem::Requirement
187
189
  requirements:
188
- - - '>='
190
+ - - ">="
189
191
  - !ruby/object:Gem::Version
190
192
  version: '0'
191
193
  requirements: []
192
194
  rubyforge_project: nowarning
193
- rubygems_version: 2.0.3
195
+ rubygems_version: 2.0.14
194
196
  signing_key:
195
197
  specification_version: 4
196
198
  summary: Prioritization Middleware for Sidekiq
@@ -202,3 +204,4 @@ test_files:
202
204
  - spec/sidekiq-apriori/worker_spec.rb
203
205
  - spec/spec_helper.rb
204
206
  - spec/support/arb.rb
207
+ has_rdoc: