delayed_job_web 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of delayed_job_web might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7179527cc2cebed1494d856765bac6dbb0657b8b
4
- data.tar.gz: 887a714ebd1e601459994058b90fe04f4e538eb2
3
+ metadata.gz: 64765045ff23c2d82edb694c0b43c789d2c1bf53
4
+ data.tar.gz: adca16793350ca13765734007509fb4272962ee0
5
5
  SHA512:
6
- metadata.gz: 069cc73508226c8e1dde5a1b37aa8641cc9438d58386c48a8db0fdb93e253d58dcedf30aa0e30daa8b3b010d640cc62ed3113169e5054cafbe557fa1f85161c0
7
- data.tar.gz: afcff45a056936ed64488f3c3b5c79953d8a486529231bef7dfb39693fcba46753a7f785883adf8517612383b572fd277de503e9130fb100d31e560f49001be3
6
+ metadata.gz: e3393593ccd0f51136ec99ed5f693961e4dac89435abf58f7d4b72ef364408f0d64cf13587af04ac9d5e561584172cae12f0da22818d36ae090d988b6b8c7968
7
+ data.tar.gz: 305ce84cc7e3de232a17d42094b4f6d4221ce6d0ea096ad309f2a42e817ee778a70f15b39ffbc12cbe87bde9f394c14b40c6bbc9d63674f34a66ade6d7c143dd
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "delayed_job_web"
3
- gem.version = "1.2.8"
3
+ gem.version = "1.2.9"
4
4
  gem.author = "Erick Schmitt"
5
5
  gem.email = "ejschmitt@gmail.com"
6
6
  gem.homepage = "https://github.com/ejschmitt/delayed_job_web"
@@ -23,9 +23,11 @@ Gem::Specification.new do |gem|
23
23
  "README.markdown"
24
24
  ]
25
25
 
26
- gem.add_runtime_dependency "sinatra", [">= 1.4.4"]
27
- gem.add_runtime_dependency "activerecord", ["> 3.0.0"]
28
- gem.add_runtime_dependency "delayed_job", ["> 2.0.3"]
29
- gem.add_development_dependency "shoulda", [">= 0"]
30
- gem.add_development_dependency "rack-test", [">= 0"]
26
+ gem.add_runtime_dependency "sinatra", [">= 1.4.4"]
27
+ gem.add_runtime_dependency "activerecord", ["> 3.0.0"]
28
+ gem.add_runtime_dependency "delayed_job", ["> 2.0.3"]
29
+
30
+ gem.add_development_dependency "minitest", ["~> 4.2"]
31
+ gem.add_development_dependency "rack-test", ["~> 0.6"]
32
+ gem.add_development_dependency "rails", ["~> 4.0"]
31
33
  end
@@ -115,6 +115,11 @@ class DelayedJobWeb < Sinatra::Base
115
115
  redirect back
116
116
  end
117
117
 
118
+ post "/requeue/all" do
119
+ delayed_jobs(:failed, @queues).update_all(:run_at => Time.now, :failed_at => nil)
120
+ redirect back
121
+ end
122
+
118
123
  post "/requeue/:id" do
119
124
  job = delayed_job.find(params[:id])
120
125
  job.update_attributes(:run_at => Time.now, :failed_at => nil)
@@ -132,11 +137,6 @@ class DelayedJobWeb < Sinatra::Base
132
137
  redirect u('failed')
133
138
  end
134
139
 
135
- post "/requeue/all" do
136
- delayed_jobs(:failed, @queues).update_all(:run_at => Time.now, :failed_at => nil)
137
- redirect back
138
- end
139
-
140
140
  def delayed_jobs(type, queues = [])
141
141
  rel = delayed_job
142
142
 
@@ -147,7 +147,7 @@ class DelayedJobWeb < Sinatra::Base
147
147
  when :failed
148
148
  rel.where('last_error IS NOT NULL')
149
149
  when :pending
150
- rel.where(:attempts => 0)
150
+ rel.where(:attempts => 0, :locked_at => nil)
151
151
  else
152
152
  rel
153
153
  end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+ require 'support/rails_app'
3
+ require 'support/delayed_job_fake'
4
+
5
+ class TestMountedInRailsApp < MiniTest::Unit::TestCase
6
+ include Rack::Test::Methods
7
+
8
+ def app
9
+ RailsApp
10
+ end
11
+
12
+ # basic smoke test all the tabs
13
+ %w(overview enqueued working pending failed stats).each do |tab|
14
+ define_method :"test_#{tab}" do
15
+ get "/delayed_job/#{tab}"
16
+ assert last_response.ok?, "Received bad response: #{last_response.inspect}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,67 @@
1
+ require 'test_helper'
2
+ require 'support/delayed_job_fake'
3
+ require 'delayed_job_web/application/app'
4
+
5
+ class TestDelayedJobWeb < MiniTest::Unit::TestCase
6
+
7
+ include Rack::Test::Methods
8
+
9
+ def app
10
+ DelayedJobWeb
11
+ end
12
+
13
+ def test_requeue_all
14
+
15
+ dataset = Minitest::Mock.new
16
+ where = lambda { | criteria |
17
+ criteria.must_equal 'last_error IS NOT NULL'
18
+ dataset
19
+ }
20
+
21
+ dataset.expect(:update_all, nil, [:run_at => time, :failed_at => nil])
22
+
23
+ Time.stub(:now, time) do
24
+ Delayed::Job.stub(:where, where) do
25
+ post "/requeue/all", request_data, rack_env
26
+ last_response.status.must_equal 302
27
+ end
28
+ end
29
+
30
+ dataset.verify
31
+
32
+ end
33
+
34
+ def test_requeue_id
35
+ job = Minitest::Mock.new
36
+ job.expect(:update_attributes, nil, [:run_at => time, :failed_at => nil])
37
+
38
+ find = lambda { | id |
39
+ id.must_equal "1"
40
+ job
41
+ }
42
+
43
+ Time.stub(:now, time) do
44
+ Delayed::Job.stub(:find, find) do
45
+ post "/requeue/1", request_data, rack_env
46
+ last_response.status.must_equal 302
47
+ end
48
+ end
49
+
50
+ job.verify
51
+ end
52
+
53
+ private
54
+
55
+ def time
56
+ @time ||= Time.now
57
+ end
58
+
59
+ def rack_env
60
+ {'rack.session' => {:csrf => "123"}}
61
+ end
62
+
63
+ def request_data
64
+ {"authenticity_token" => "123"}
65
+ end
66
+
67
+ end
@@ -0,0 +1,34 @@
1
+ require 'delayed_job'
2
+
3
+ class Delayed::Job
4
+ class DelayedJobFake < Array
5
+ # fake out arel
6
+ def order(*args)
7
+ DelayedJobFake.new
8
+ end
9
+
10
+ def offset(*args)
11
+ DelayedJobFake.new
12
+ end
13
+
14
+ def limit(*args)
15
+ DelayedJobFake.new
16
+ end
17
+ end
18
+
19
+ def self.where(*args)
20
+ DelayedJobFake.new
21
+ end
22
+
23
+ def self.count(*args)
24
+ 0
25
+ end
26
+
27
+ def self.order(*args)
28
+ DelayedJobFake.new
29
+ end
30
+
31
+ def self.find(*args)
32
+ DelayedJobFake.new
33
+ end
34
+ end
@@ -0,0 +1,12 @@
1
+ require "action_controller/railtie"
2
+ require "logger"
3
+ require "delayed_job_web"
4
+
5
+ class RailsApp < Rails::Application
6
+ config.logger = Rails.logger = Logger.new(nil)
7
+ config.secret_key_base = "foo"
8
+
9
+ routes.draw do
10
+ match "/delayed_job" => DelayedJobWeb, :anchor => false, via: [:get, :post]
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ require "bundler"
4
+ Bundler.setup(:default, :development)
5
+ require "minitest/autorun"
6
+
7
+ ENV['RACK_ENV'] = 'test'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erick Schmitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-17 00:00:00.000000000 Z
11
+ date: 2014-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -53,33 +53,47 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.0.3
55
55
  - !ruby/object:Gem::Dependency
56
- name: shoulda
56
+ name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '4.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '4.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rack-test
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '0.6'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '0.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
81
95
  - !ruby/object:Gem::Version
82
- version: '0'
96
+ version: '4.0'
83
97
  description: Web interface for delayed_job inspired by resque
84
98
  email: ejschmitt@gmail.com
85
99
  executables:
@@ -114,8 +128,11 @@ files:
114
128
  - lib/delayed_job_web/application/views/stats.erb
115
129
  - lib/delayed_job_web/application/views/working.erb
116
130
  - lib/delayed_job_web/railtie.rb
117
- - test/helper.rb
118
- - test/test_delayed_job_web.rb
131
+ - test/integration/test_mounted_in_rails_app.rb
132
+ - test/lib/delayed_job_web/application/test_app.rb
133
+ - test/support/delayed_job_fake.rb
134
+ - test/support/rails_app.rb
135
+ - test/test_helper.rb
119
136
  homepage: https://github.com/ejschmitt/delayed_job_web
120
137
  licenses:
121
138
  - MIT
@@ -141,4 +158,3 @@ signing_key:
141
158
  specification_version: 4
142
159
  summary: Web interface for delayed_job inspired by resque
143
160
  test_files: []
144
- has_rdoc:
data/test/helper.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'delayed_job_web'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,52 +0,0 @@
1
- require 'helper'
2
- require 'rack/test'
3
- require 'delayed_job_web/application/app'
4
- ENV['RACK_ENV'] = 'test'
5
-
6
- class Delayed::Job
7
- class DelayedJobFake < Array
8
- # fake out arel
9
- def order(*args)
10
- DelayedJobFake.new
11
- end
12
-
13
- def offset(*args)
14
- DelayedJobFake.new
15
- end
16
-
17
- def limit(*args)
18
- DelayedJobFake.new
19
- end
20
- end
21
-
22
- def self.where(*args)
23
- DelayedJobFake.new
24
- end
25
-
26
- def self.count(*args)
27
- 0
28
- end
29
-
30
- def self.order(*args)
31
- DelayedJobFake.new
32
- end
33
- end
34
-
35
- class TestDelayedJobWeb < Test::Unit::TestCase
36
- include Rack::Test::Methods
37
- def app
38
- DelayedJobWeb.new
39
- end
40
-
41
- def should_respond_with_success
42
- assert last_response.ok?, last_response.errors
43
- end
44
-
45
- # basic smoke test all the tabs
46
- %w(overview enqueued working pending failed stats).each do |tab|
47
- should "get '/#{tab}'" do
48
- get "/#{tab}"
49
- should_respond_with_success
50
- end
51
- end
52
- end