resque-scheduler-web 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/resque_web/plugins/resque_scheduler/delayed_controller.rb +3 -0
- data/app/controllers/resque_web/plugins/resque_scheduler/schedules_controller.rb +4 -5
- data/app/views/resque_web/plugins/resque_scheduler/delayed/index.erb +2 -2
- data/app/views/resque_web/plugins/resque_scheduler/delayed/timestamp.erb +5 -6
- data/app/views/resque_web/plugins/resque_scheduler/schedules/index.html.erb +1 -1
- data/lib/resque/scheduler/web/version.rb +1 -1
- data/resque-scheduler-web.gemspec +4 -3
- data/spec/controllers/{delayed_controller_spec.rb → resque_web/plugins/resque_scheduler/delayed_controller_spec.rb} +1 -2
- data/spec/controllers/{schedules_controller_spec.rb → resque_web/plugins/resque_scheduler/schedules_controller_spec.rb} +4 -0
- data/spec/features/delayed/delayed_jobs_index_page_spec.rb +24 -0
- data/spec/features/delayed/delayed_jobs_timestamp_page_spec.rb +29 -0
- data/spec/features/schedules/cannot_delete_a_job_when_the_schedule_is_static.rb +41 -0
- data/spec/features/schedules/delete_a_job_from_the_dynamic_schedule_spec.rb +68 -0
- data/spec/features/schedules/requeuing_a_job_with_parameters_spec.rb +3 -3
- data/spec/features/schedules/requeuing_a_job_without_parameters_spec.rb +43 -0
- data/spec/features/schedules/{scheduled_jobs_page_spec.rb → scheduled_jobs_index_page_spec.rb} +5 -8
- data/spec/models/{job_finder → resque_web/plugins/resque_scheduler/job_finder}/working_job_finder_spec.rb +2 -3
- data/spec/models/{job_finder_spec.rb → resque_web/plugins/resque_scheduler/job_finder_spec.rb} +2 -3
- data/spec/routing/{delayed_routing_spec.rb → resque_web/plugins/resque_scheduler/delayed_routing_spec.rb} +0 -0
- data/spec/spec_helper.rb +3 -1
- data/spec/support/functions.rb +7 -0
- data/spec/support/redis_instance.rb +1 -8
- data/spec/support/test_jobs.rb +3 -1
- metadata +46 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdaf732772b3cf1c129b8394190a3e3e2d991d01
|
4
|
+
data.tar.gz: 932897408224f2238e1a5323c415fc26f08164b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c9d83155665494ef45db59edb1ae4e61b3017ca46a17620f4ba748ec577d5c2088f944de2b3154dd27a60fc73d79a18ea6abfbbd1b3101f06a935b201b4ea6d
|
7
|
+
data.tar.gz: 2cda060442328d84b6ffe8b01687bc665811e69ff0713fadf295160e889a3bd1913ecc089696828ff3778f2804b4ce3d2a8db63b10245990169c07ecb0243531
|
@@ -56,6 +56,9 @@ module ResqueWeb
|
|
56
56
|
# GET /delayed/:timestamp
|
57
57
|
def timestamp
|
58
58
|
@timestamp = params[:timestamp].to_i
|
59
|
+
@start = params[:start].to_i
|
60
|
+
@size = Resque.delayed_timestamp_size(@timestamp)
|
61
|
+
@jobs = Resque.delayed_timestamp_peek(@timestamp, @start, 20)
|
59
62
|
end
|
60
63
|
end
|
61
64
|
end
|
@@ -45,8 +45,7 @@ module ResqueWeb
|
|
45
45
|
|
46
46
|
# POST /schedule/requeue_with_params
|
47
47
|
def requeue_with_params
|
48
|
-
|
49
|
-
config = Resque.schedule[job_name]
|
48
|
+
config = Resque.schedule[params[:job_name]]
|
50
49
|
# Build args hash from post data (removing the job name)
|
51
50
|
submitted_args = params.reject do |key, _value|
|
52
51
|
%w(job_name action controller).include?(key)
|
@@ -54,11 +53,11 @@ module ResqueWeb
|
|
54
53
|
|
55
54
|
# Merge constructed args hash with existing args hash for
|
56
55
|
# the job, if it exists
|
57
|
-
|
58
|
-
|
56
|
+
existing_config_args = config['args'] || config[:args] || {}
|
57
|
+
new_config_args = existing_config_args.merge(submitted_args)
|
59
58
|
|
60
59
|
# Insert the args hash into config and queue the resque job
|
61
|
-
config = config.merge('args' =>
|
60
|
+
config = config.merge('args' => new_config_args)
|
62
61
|
Resque::Scheduler.enqueue_from_config(config)
|
63
62
|
redirect_to ResqueWeb::Engine.app.url_helpers.overview_path
|
64
63
|
end
|
@@ -31,13 +31,13 @@
|
|
31
31
|
</form>
|
32
32
|
</td>
|
33
33
|
<td><a href="<%= delayed_path timestamp: timestamp %>"><%= format_time(Time.at(timestamp)) %></a></td>
|
34
|
-
<td><%= delayed_timestamp_size = Resque.delayed_timestamp_size(timestamp) %></td>
|
34
|
+
<td class="job-count"><%= delayed_timestamp_size = Resque.delayed_timestamp_size(timestamp) %></td>
|
35
35
|
<% job = Resque.delayed_timestamp_peek(timestamp, 0, 1).first %>
|
36
36
|
<td>
|
37
37
|
<% if job && delayed_timestamp_size == 1 %>
|
38
38
|
<%= h(job['class']) %>
|
39
39
|
<% else %>
|
40
|
-
<a href="<%=
|
40
|
+
<a href="<%= timestamp_path timestamp: timestamp %>">see details</a>
|
41
41
|
<% end %>
|
42
42
|
</td>
|
43
43
|
<td><%= h(job['args'].inspect) if job && delayed_timestamp_size == 1 %></td>
|
@@ -1,25 +1,24 @@
|
|
1
1
|
<h1>Delayed jobs scheduled for <%= format_time(Time.at(@timestamp)) %></h1>
|
2
2
|
|
3
|
-
<p class='sub'>Showing <%= start
|
3
|
+
<p class='sub'>Showing <%= @start %> to <%= [@size, 20].min %> of <b><%= @size %></b> jobs</p>
|
4
4
|
|
5
|
-
<table class='jobs'>
|
5
|
+
<table class='jobs table table-bordered'>
|
6
6
|
<tr>
|
7
7
|
<th>Class</th>
|
8
8
|
<th>Args</th>
|
9
9
|
</tr>
|
10
|
-
<% jobs
|
11
|
-
<% jobs.each do |job| %>
|
10
|
+
<% @jobs.each do |job| %>
|
12
11
|
<tr>
|
13
12
|
<td class='class'><%= job['class'] %></td>
|
14
13
|
<td class='args'><%=h job['args'].inspect %></td>
|
15
14
|
</tr>
|
16
15
|
<% end %>
|
17
|
-
<% if jobs.empty? %>
|
16
|
+
<% if @jobs.empty? %>
|
18
17
|
<tr>
|
19
18
|
<td class='no-data' colspan='2'>There are no pending jobs scheduled for this time.</td>
|
20
19
|
</tr>
|
21
20
|
<% end %>
|
22
21
|
</table>
|
23
22
|
|
24
|
-
<%= render partial: 'next_more', locals: {:start => start, :size => size} %>
|
23
|
+
<%= render partial: 'next_more', locals: {:start => @start, :size => @size} %>
|
25
24
|
|
@@ -28,7 +28,7 @@
|
|
28
28
|
<form action="<%= schedule_path %>" method="post" style="margin-left: 0">
|
29
29
|
<input type="hidden" name="job_name" value="<%= h job_name %>">
|
30
30
|
<input type="hidden" name="_method" value="delete">
|
31
|
-
<input type="submit" value="Delete">
|
31
|
+
<input type="submit" value="Delete" class="delete-button">
|
32
32
|
</form>
|
33
33
|
</td>
|
34
34
|
<% end %>
|
@@ -32,9 +32,10 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
33
33
|
spec.add_development_dependency 'rspec-rails', '~> 3.2'
|
34
34
|
spec.add_development_dependency 'capybara', '~> 2.4'
|
35
|
-
spec.add_development_dependency 'codeclimate-test-reporter'
|
36
|
-
spec.add_development_dependency 'rubocop'
|
37
|
-
spec.add_development_dependency 'rubocop-rspec'
|
35
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0'
|
36
|
+
spec.add_development_dependency 'rubocop', '~> 0'
|
37
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.0'
|
38
|
+
spec.add_development_dependency 'launchy', '~> 0'
|
38
39
|
# Avoids non-thread-safe error.
|
39
40
|
spec.add_development_dependency 'sass', '~> 3.4'
|
40
41
|
end
|
@@ -7,8 +7,7 @@ describe ResqueWeb::Plugins::ResqueScheduler::DelayedController,
|
|
7
7
|
let(:some_time_in_the_future) { Time.now + 3600 }
|
8
8
|
|
9
9
|
after do
|
10
|
-
|
11
|
-
Resque.queues.each { |q| Resque.remove_queue q }
|
10
|
+
reset_the_resque_schedule
|
12
11
|
end
|
13
12
|
|
14
13
|
describe 'GET index' do
|
@@ -4,6 +4,10 @@ describe ResqueWeb::Plugins::ResqueScheduler::SchedulesController,
|
|
4
4
|
type: :controller do
|
5
5
|
routes { ResqueWeb::Plugins::ResqueScheduler::Engine.routes }
|
6
6
|
|
7
|
+
after do
|
8
|
+
reset_the_resque_schedule
|
9
|
+
end
|
10
|
+
|
7
11
|
describe 'GET index' do
|
8
12
|
before do
|
9
13
|
Resque::Scheduler.env = 'production'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature 'seeing all the delayed jobs on the index page' do
|
4
|
+
|
5
|
+
after do
|
6
|
+
reset_the_resque_schedule
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:some_time_in_the_future) { Time.now + 3600 }
|
10
|
+
let(:some_other_time_in_the_future) { Time.now + 4600 }
|
11
|
+
|
12
|
+
# Given there is a delayed job
|
13
|
+
# And another delayed job enqueued at a later time
|
14
|
+
# When I visit the delayed jobs index page
|
15
|
+
# Then I should see the job on the page
|
16
|
+
scenario 'delayed jobs show up on the page when at different times' do
|
17
|
+
Resque.enqueue_at(some_time_in_the_future, SomeIvarJob)
|
18
|
+
Resque.enqueue_at(some_other_time_in_the_future, JobWithoutParams)
|
19
|
+
visit resque_scheduler_engine_routes.delayed_path
|
20
|
+
expect(page).to have_content 'SomeIvarJob'
|
21
|
+
expect(page).to have_content 'JobWithoutParams'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature 'seeing a summary of the delayed jobs for a timestamp on the index' do
|
4
|
+
|
5
|
+
after do
|
6
|
+
reset_the_resque_schedule
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:some_time_in_the_future) { Time.now + 3600 }
|
10
|
+
let(:some_other_time_in_the_future) { Time.now + 4600 }
|
11
|
+
|
12
|
+
# Given there is a delayed job
|
13
|
+
# And another delayed job enqueued at the same time
|
14
|
+
# When I visit the delayed jobs index page
|
15
|
+
# Then I should see the jobs on the page as a summary
|
16
|
+
# When I click through to the details page
|
17
|
+
# Then I should see the details of the jobs
|
18
|
+
scenario 'delayed jobs show up on the page when at the same times' do
|
19
|
+
Resque.enqueue_at(some_time_in_the_future, JobWithParams, { argument: 'thingy' })
|
20
|
+
Resque.enqueue_at(some_time_in_the_future, JobWithoutParams)
|
21
|
+
visit resque_scheduler_engine_routes.delayed_path
|
22
|
+
expect(page).to have_css '.job-count', text: '2'
|
23
|
+
click_link 'see details'
|
24
|
+
expect(page).to have_content 'JobWithParams'
|
25
|
+
expect(page).to have_content '"argument"=>"thingy"'
|
26
|
+
expect(page).to have_content 'JobWithoutParams'
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature 'deleting a job from the dynamic schedule' do
|
4
|
+
|
5
|
+
def visit_scheduler_page
|
6
|
+
visit resque_scheduler_engine_routes.schedules_path
|
7
|
+
end
|
8
|
+
|
9
|
+
before do
|
10
|
+
Resque.schedule = {
|
11
|
+
'some_ivar_job' => {
|
12
|
+
'cron' => '* * * * *',
|
13
|
+
'class' => 'SomeIvarJob',
|
14
|
+
'args' => '/tmp',
|
15
|
+
'rails_env' => 'test'
|
16
|
+
},
|
17
|
+
'some_other_job' => {
|
18
|
+
'every' => ['1m', ['1h']],
|
19
|
+
'queue' => 'high',
|
20
|
+
'custom_job_class' => 'SomeOtherJob',
|
21
|
+
'rails_env' => 'test',
|
22
|
+
'args' => {
|
23
|
+
'b' => 'blah'
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
allow(Resque::Scheduler).to receive(:dynamic).and_return(false)
|
28
|
+
Resque::Scheduler.load_schedule!
|
29
|
+
visit_scheduler_page
|
30
|
+
end
|
31
|
+
|
32
|
+
after do
|
33
|
+
reset_the_resque_schedule
|
34
|
+
end
|
35
|
+
|
36
|
+
scenario 'the delete button is not present when the schedule is static' do
|
37
|
+
visit resque_scheduler_engine_routes.schedules_path
|
38
|
+
expect(page).to_not have_css '#job_some_ivar_job .delete-button'
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature 'deleting a job from the dynamic schedule' do
|
4
|
+
|
5
|
+
def visit_scheduler_page
|
6
|
+
visit resque_scheduler_engine_routes.schedules_path
|
7
|
+
end
|
8
|
+
|
9
|
+
before do
|
10
|
+
Resque.schedule = {
|
11
|
+
'some_ivar_job' => {
|
12
|
+
'cron' => '* * * * *',
|
13
|
+
'class' => 'SomeIvarJob',
|
14
|
+
'args' => '/tmp',
|
15
|
+
'rails_env' => 'test'
|
16
|
+
},
|
17
|
+
'some_other_job' => {
|
18
|
+
'every' => ['1m', ['1h']],
|
19
|
+
'queue' => 'high',
|
20
|
+
'custom_job_class' => 'SomeOtherJob',
|
21
|
+
'rails_env' => 'test',
|
22
|
+
'args' => {
|
23
|
+
'b' => 'blah'
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
allow(Resque::Scheduler).to receive(:dynamic).and_return(true)
|
28
|
+
Resque::Scheduler.load_schedule!
|
29
|
+
visit_scheduler_page
|
30
|
+
end
|
31
|
+
|
32
|
+
after do
|
33
|
+
reset_the_resque_schedule
|
34
|
+
end
|
35
|
+
|
36
|
+
# Given there is a job in the scheduler
|
37
|
+
# And the schedule is set up to be dynamic
|
38
|
+
# When I delete the job from the UI
|
39
|
+
# Then I should be on the schedule page
|
40
|
+
# And the job should no longer be present
|
41
|
+
scenario 'the job disappears from the UI' do
|
42
|
+
find('#job_some_ivar_job .delete-button').click
|
43
|
+
expect(current_path).to eq resque_scheduler_engine_routes.schedules_path
|
44
|
+
expect(page).to_not have_css '#job_some_ivar_job'
|
45
|
+
end
|
46
|
+
|
47
|
+
# Given there are two jobs in the scheduler
|
48
|
+
# And the schedule is set up to be dynamic
|
49
|
+
# When I delete the job from the UI
|
50
|
+
# Then I should be on the schedule page
|
51
|
+
# And the other job should still be present
|
52
|
+
scenario 'the other job remains in the UI' do
|
53
|
+
find('#job_some_ivar_job .delete-button').click
|
54
|
+
expect(current_path).to eq resque_scheduler_engine_routes.schedules_path
|
55
|
+
expect(page).to have_css '#job_some_other_job'
|
56
|
+
end
|
57
|
+
|
58
|
+
# Given there is a job in the scheduler
|
59
|
+
# And the schedule is set up to be dynamic
|
60
|
+
# When I delete the job from the UI
|
61
|
+
# Then I should be on the schedule page
|
62
|
+
# And the job should no longer be present in the Resque schedule
|
63
|
+
scenario 'the job is removed from the resque backend' do
|
64
|
+
find('#job_some_ivar_job .delete-button').click
|
65
|
+
expect(current_path).to eq resque_scheduler_engine_routes.schedules_path
|
66
|
+
expect(Resque.schedule).to_not have_key 'some_ivar_job'
|
67
|
+
end
|
68
|
+
end
|
@@ -7,9 +7,7 @@ feature 'requeuing a job that has defined params' do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
after do
|
10
|
-
|
11
|
-
Resque.queues.each { |q| Resque.remove_queue q }
|
12
|
-
Resque.schedule = {}
|
10
|
+
reset_the_resque_schedule
|
13
11
|
end
|
14
12
|
|
15
13
|
# Given I have a job which requires params in the schedule
|
@@ -32,6 +30,8 @@ feature 'requeuing a job that has defined params' do
|
|
32
30
|
click_button 'Queue now'
|
33
31
|
|
34
32
|
expect(current_path).to eq ResqueWeb::Engine.app.url_helpers.overview_path
|
33
|
+
expect(page).to have_content "#{queue_name} 1"
|
34
|
+
|
35
35
|
find('.queues .queue a', text: queue_name).click
|
36
36
|
|
37
37
|
expect(page).to have_content job_class
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature 'requeuing a job that has no params' do
|
4
|
+
before do
|
5
|
+
Resque.schedule = {
|
6
|
+
'job_without_params' => {
|
7
|
+
'cron' => '* * * * *',
|
8
|
+
'class' => 'JobWithoutParams',
|
9
|
+
'args' => {
|
10
|
+
'host' => 'localhost'
|
11
|
+
},
|
12
|
+
'rails_env' => 'test'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
Resque::Scheduler.load_schedule!
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
reset_the_resque_schedule
|
20
|
+
end
|
21
|
+
|
22
|
+
# Given I have a job which requires params in the schedule
|
23
|
+
# When I press the requeue button
|
24
|
+
# Then I should be on the overview page
|
25
|
+
# And I should see the job in the queue
|
26
|
+
# When I visit the queue page
|
27
|
+
# Then I should see the job on the page with the new params
|
28
|
+
scenario 'I am prompted to enter the params required for the requeued job' do
|
29
|
+
job_name = 'job_without_params'
|
30
|
+
queue_name = 'quick'
|
31
|
+
job_class = 'JobWithoutParams'
|
32
|
+
|
33
|
+
visit resque_scheduler_engine_routes.schedules_path
|
34
|
+
click_button "requeue_job_#{job_name}"
|
35
|
+
|
36
|
+
expect(current_path).to eq ResqueWeb::Engine.app.url_helpers.overview_path
|
37
|
+
expect(page).to have_content "#{queue_name} 1"
|
38
|
+
|
39
|
+
find('.queues .queue a', text: queue_name).click
|
40
|
+
|
41
|
+
expect(page).to have_content job_class
|
42
|
+
end
|
43
|
+
end
|
data/spec/features/schedules/{scheduled_jobs_page_spec.rb → scheduled_jobs_index_page_spec.rb}
RENAMED
@@ -42,10 +42,7 @@ feature 'Viewing the schedule page and interacting with it' do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
after do
|
45
|
-
|
46
|
-
Resque.queues.each { |q| Resque.remove_queue q }
|
47
|
-
Resque.schedule = {}
|
48
|
-
Resque::Scheduler.env = 'test'
|
45
|
+
reset_the_resque_schedule
|
49
46
|
end
|
50
47
|
|
51
48
|
it 'Link to Schedule page in navigation works' do
|
@@ -54,16 +51,16 @@ feature 'Viewing the schedule page and interacting with it' do
|
|
54
51
|
assert page.has_css? 'h1', 'Schedule'
|
55
52
|
end
|
56
53
|
|
57
|
-
it '
|
54
|
+
it 'has the correct title' do
|
58
55
|
assert page.has_css?('h1', 'Schedule')
|
59
56
|
end
|
60
57
|
|
61
|
-
it '
|
58
|
+
it 'shows the scheduled job' do
|
62
59
|
assert page.body.include?('SomeIvarJob')
|
63
60
|
end
|
64
61
|
|
65
62
|
it 'excludes jobs for other envs' do
|
66
|
-
|
63
|
+
refute page.body.include?('SomeFancyJob')
|
67
64
|
end
|
68
65
|
|
69
66
|
it 'includes job used in multiple environments' do
|
@@ -81,6 +78,6 @@ feature 'Viewing the schedule page and interacting with it' do
|
|
81
78
|
allow(Resque::Scheduler).to receive(:dynamic).and_return(false)
|
82
79
|
visit_scheduler_page
|
83
80
|
|
84
|
-
|
81
|
+
refute page.body.include?('Delete')
|
85
82
|
end
|
86
83
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative '../../../../../../app/models/resque_web/plugins/'\
|
2
2
|
'resque_scheduler/job_finder/working_job_finder'
|
3
3
|
|
4
4
|
describe ResqueWeb::Plugins::ResqueScheduler::JobFinder::WorkingJobFinder do
|
@@ -14,8 +14,7 @@ describe ResqueWeb::Plugins::ResqueScheduler::JobFinder::WorkingJobFinder do
|
|
14
14
|
|
15
15
|
after do
|
16
16
|
@worker_thread.kill
|
17
|
-
|
18
|
-
Resque.queues.each { |q| Resque.remove_queue q }
|
17
|
+
reset_the_resque_schedule
|
19
18
|
end
|
20
19
|
|
21
20
|
it 'finds a working job when the search term matches' do
|
data/spec/models/{job_finder_spec.rb → resque_web/plugins/resque_scheduler/job_finder_spec.rb}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative '../../../../../app/models/resque_web/plugins/'\
|
2
2
|
'resque_scheduler/job_finder'
|
3
3
|
|
4
4
|
describe ResqueWeb::Plugins::ResqueScheduler::JobFinder do
|
@@ -7,8 +7,7 @@ describe ResqueWeb::Plugins::ResqueScheduler::JobFinder do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
after do
|
10
|
-
|
11
|
-
Resque.queues.each { |q| Resque.remove_queue q }
|
10
|
+
reset_the_resque_schedule
|
12
11
|
end
|
13
12
|
|
14
13
|
context 'with a scheduled job queued in the future' do
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -4,8 +4,9 @@ CodeClimate::TestReporter.start
|
|
4
4
|
ENV['RAILS_ENV'] = 'test'
|
5
5
|
|
6
6
|
require 'resque'
|
7
|
-
|
8
7
|
require 'resque-scheduler'
|
8
|
+
require_relative 'support/functions'
|
9
|
+
|
9
10
|
|
10
11
|
Resque::Scheduler.configure do |c|
|
11
12
|
c.quiet = true
|
@@ -93,3 +94,4 @@ end
|
|
93
94
|
def resque_scheduler_engine_routes
|
94
95
|
ResqueWeb::Plugins::ResqueScheduler::Engine.app.url_helpers
|
95
96
|
end
|
97
|
+
|
@@ -8,11 +8,6 @@ require 'fileutils'
|
|
8
8
|
# running on the same port.
|
9
9
|
class RedisInstance
|
10
10
|
class << self
|
11
|
-
@running = false
|
12
|
-
@port = nil
|
13
|
-
@pid = nil
|
14
|
-
@waiting = false
|
15
|
-
|
16
11
|
def run_if_needed!
|
17
12
|
run! unless @running
|
18
13
|
end
|
@@ -23,7 +18,6 @@ class RedisInstance
|
|
23
18
|
reassign_redis_clients
|
24
19
|
start_redis_server
|
25
20
|
post_boot_waiting_and_such
|
26
|
-
|
27
21
|
@running = true
|
28
22
|
end
|
29
23
|
|
@@ -98,7 +92,7 @@ class RedisInstance
|
|
98
92
|
end
|
99
93
|
|
100
94
|
def pid_file
|
101
|
-
'/tmp/
|
95
|
+
'/tmp/resque-scheduler-web-test.pid'
|
102
96
|
end
|
103
97
|
|
104
98
|
def config
|
@@ -112,7 +106,6 @@ class RedisInstance
|
|
112
106
|
# Returns a random port in the upper (10000-65535) range.
|
113
107
|
def random_port
|
114
108
|
ports = (10_000..65_535).to_a
|
115
|
-
|
116
109
|
loop do
|
117
110
|
port = ports[rand(ports.size)]
|
118
111
|
return port if port_available?('127.0.0.1', port)
|
data/spec/support/test_jobs.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-scheduler-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Gibson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: resque-web
|
@@ -126,42 +126,56 @@ dependencies:
|
|
126
126
|
name: codeclimate-test-reporter
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rubocop
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rubocop-rspec
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: launchy
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
158
172
|
- !ruby/object:Gem::Version
|
159
173
|
version: '0'
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
|
-
- - "
|
178
|
+
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
@@ -215,8 +229,8 @@ files:
|
|
215
229
|
- lib/resque/scheduler/web/version.rb
|
216
230
|
- lib/resque_web/plugins/resque_scheduler/engine.rb
|
217
231
|
- resque-scheduler-web.gemspec
|
218
|
-
- spec/controllers/delayed_controller_spec.rb
|
219
|
-
- spec/controllers/schedules_controller_spec.rb
|
232
|
+
- spec/controllers/resque_web/plugins/resque_scheduler/delayed_controller_spec.rb
|
233
|
+
- spec/controllers/resque_web/plugins/resque_scheduler/schedules_controller_spec.rb
|
220
234
|
- spec/dummy/README.rdoc
|
221
235
|
- spec/dummy/Rakefile
|
222
236
|
- spec/dummy/app/assets/images/.keep
|
@@ -257,19 +271,24 @@ files:
|
|
257
271
|
- spec/dummy/lib/assets/.keep
|
258
272
|
- spec/dummy/log/.keep
|
259
273
|
- spec/dummy/log/development.log
|
260
|
-
- spec/dummy/log/test.log
|
261
274
|
- spec/dummy/public/404.html
|
262
275
|
- spec/dummy/public/422.html
|
263
276
|
- spec/dummy/public/500.html
|
264
277
|
- spec/dummy/public/favicon.ico
|
278
|
+
- spec/features/delayed/delayed_jobs_index_page_spec.rb
|
279
|
+
- spec/features/delayed/delayed_jobs_timestamp_page_spec.rb
|
265
280
|
- spec/features/navigation_spec.rb
|
281
|
+
- spec/features/schedules/cannot_delete_a_job_when_the_schedule_is_static.rb
|
282
|
+
- spec/features/schedules/delete_a_job_from_the_dynamic_schedule_spec.rb
|
266
283
|
- spec/features/schedules/requeuing_a_job_with_parameters_spec.rb
|
267
|
-
- spec/features/schedules/
|
268
|
-
- spec/
|
269
|
-
- spec/models/
|
284
|
+
- spec/features/schedules/requeuing_a_job_without_parameters_spec.rb
|
285
|
+
- spec/features/schedules/scheduled_jobs_index_page_spec.rb
|
286
|
+
- spec/models/resque_web/plugins/resque_scheduler/job_finder/working_job_finder_spec.rb
|
287
|
+
- spec/models/resque_web/plugins/resque_scheduler/job_finder_spec.rb
|
270
288
|
- spec/rails_helper.rb
|
271
|
-
- spec/routing/delayed_routing_spec.rb
|
289
|
+
- spec/routing/resque_web/plugins/resque_scheduler/delayed_routing_spec.rb
|
272
290
|
- spec/spec_helper.rb
|
291
|
+
- spec/support/functions.rb
|
273
292
|
- spec/support/redis_instance.rb
|
274
293
|
- spec/support/test_jobs.rb
|
275
294
|
homepage: https://github.com/mattgibson/resque-scheduler-web
|
@@ -297,8 +316,8 @@ signing_key:
|
|
297
316
|
specification_version: 4
|
298
317
|
summary: This gem provides tabs in Resque Web for managing Resque Scheduler.
|
299
318
|
test_files:
|
300
|
-
- spec/controllers/delayed_controller_spec.rb
|
301
|
-
- spec/controllers/schedules_controller_spec.rb
|
319
|
+
- spec/controllers/resque_web/plugins/resque_scheduler/delayed_controller_spec.rb
|
320
|
+
- spec/controllers/resque_web/plugins/resque_scheduler/schedules_controller_spec.rb
|
302
321
|
- spec/dummy/README.rdoc
|
303
322
|
- spec/dummy/Rakefile
|
304
323
|
- spec/dummy/app/assets/images/.keep
|
@@ -339,18 +358,23 @@ test_files:
|
|
339
358
|
- spec/dummy/lib/assets/.keep
|
340
359
|
- spec/dummy/log/.keep
|
341
360
|
- spec/dummy/log/development.log
|
342
|
-
- spec/dummy/log/test.log
|
343
361
|
- spec/dummy/public/404.html
|
344
362
|
- spec/dummy/public/422.html
|
345
363
|
- spec/dummy/public/500.html
|
346
364
|
- spec/dummy/public/favicon.ico
|
365
|
+
- spec/features/delayed/delayed_jobs_index_page_spec.rb
|
366
|
+
- spec/features/delayed/delayed_jobs_timestamp_page_spec.rb
|
347
367
|
- spec/features/navigation_spec.rb
|
368
|
+
- spec/features/schedules/cannot_delete_a_job_when_the_schedule_is_static.rb
|
369
|
+
- spec/features/schedules/delete_a_job_from_the_dynamic_schedule_spec.rb
|
348
370
|
- spec/features/schedules/requeuing_a_job_with_parameters_spec.rb
|
349
|
-
- spec/features/schedules/
|
350
|
-
- spec/
|
351
|
-
- spec/models/
|
371
|
+
- spec/features/schedules/requeuing_a_job_without_parameters_spec.rb
|
372
|
+
- spec/features/schedules/scheduled_jobs_index_page_spec.rb
|
373
|
+
- spec/models/resque_web/plugins/resque_scheduler/job_finder/working_job_finder_spec.rb
|
374
|
+
- spec/models/resque_web/plugins/resque_scheduler/job_finder_spec.rb
|
352
375
|
- spec/rails_helper.rb
|
353
|
-
- spec/routing/delayed_routing_spec.rb
|
376
|
+
- spec/routing/resque_web/plugins/resque_scheduler/delayed_routing_spec.rb
|
354
377
|
- spec/spec_helper.rb
|
378
|
+
- spec/support/functions.rb
|
355
379
|
- spec/support/redis_instance.rb
|
356
380
|
- spec/support/test_jobs.rb
|