sidekiq-status 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -100,15 +100,35 @@ Sidekiq::Status.cancel scheduled_job_id #=> true
100
100
  Sidekiq::Status.unschedule scheduled_job_id #=> true
101
101
  ```
102
102
 
103
+ ### Testing
104
+
105
+ Drawing analogy from [sidekiq testing by inlining](https://github.com/mperham/sidekiq/wiki/Testing#testing-workers-inline),
106
+ `sidekiq-status` allows to bypass redis and return a stubbed `:complete` status.
107
+ Since inlining your sidekiq worker will run it in-process, any exception it throws will make your test fail.
108
+ It will also run synchronously, so by the time you get to query the job status, the job will have been completed
109
+ successfully.
110
+ In other words, you'll get the `:complete` status only if the job didn't fail.
111
+
112
+ Inlining example:
113
+
114
+ You can run Sidekiq workers inline in your tests by requiring the `sidekiq/testing/inline` file in your `{test,spec}_helper.rb`:
115
+
116
+ `require 'sidekiq/testing/inline'`
117
+
118
+ To use `sidekiq-status` inlining, require it too in your `{test,spec}_helper.rb`:
119
+
120
+ `require 'sidekiq-status/testing/inline'`
121
+
122
+
103
123
  ### Features coming
104
124
  * Stopping jobs by id
105
125
  * Minimal web UI
106
126
 
107
127
  ## Thanks
108
- Andrew Korzhuev
109
- Jon Moses
110
- Wayne Hoover
111
- Dylan Robinson
128
+ * Andrew Korzhuev
129
+ * Jon Moses
130
+ * Wayne Hoover
131
+ * Dylan Robinson
112
132
 
113
133
  ## License
114
134
  MIT License , see LICENSE for more details.
@@ -0,0 +1,10 @@
1
+ module Sidekiq
2
+ module Status
3
+ class << self
4
+ def status(jid)
5
+ :complete
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Status
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sidekiq::Status do
4
+ let!(:job_id) { SecureRandom.hex(12) }
5
+ describe '.status' do
6
+ it 'bypasses redis with inlining enabled' do
7
+ Process.fork {
8
+ require 'sidekiq-status/testing/inline'
9
+ expect(Sidekiq::Status.status(job_id)).to eq :complete
10
+ }
11
+ end
12
+ end
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-status
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-31 00:00:00.000000000 Z
12
+ date: 2013-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -77,11 +77,13 @@ files:
77
77
  - lib/sidekiq-status/client_middleware.rb
78
78
  - lib/sidekiq-status/server_middleware.rb
79
79
  - lib/sidekiq-status/storage.rb
80
+ - lib/sidekiq-status/testing/inline.rb
80
81
  - lib/sidekiq-status/version.rb
81
82
  - lib/sidekiq-status/worker.rb
82
83
  - sidekiq-status.gemspec
83
84
  - spec/lib/sidekiq-status/client_middleware_spec.rb
84
85
  - spec/lib/sidekiq-status/server_middleware_spec.rb
86
+ - spec/lib/sidekiq-status/testing_spec.rb
85
87
  - spec/lib/sidekiq-status/worker_spec.rb
86
88
  - spec/lib/sidekiq-status_spec.rb
87
89
  - spec/spec_helper.rb
@@ -114,6 +116,7 @@ summary: An extension to the sidekiq message processing to track your jobs
114
116
  test_files:
115
117
  - spec/lib/sidekiq-status/client_middleware_spec.rb
116
118
  - spec/lib/sidekiq-status/server_middleware_spec.rb
119
+ - spec/lib/sidekiq-status/testing_spec.rb
117
120
  - spec/lib/sidekiq-status/worker_spec.rb
118
121
  - spec/lib/sidekiq-status_spec.rb
119
122
  - spec/spec_helper.rb