resque-web-edge 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +96 -0
- data/Rakefile +34 -0
- data/app/assets/images/resque_web/idle.png +0 -0
- data/app/assets/images/resque_web/lifebuoy.png +0 -0
- data/app/assets/images/resque_web/poll.png +0 -0
- data/app/assets/images/resque_web/rails.png +0 -0
- data/app/assets/images/resque_web/working.png +0 -0
- data/app/assets/javascripts/resque_web/application.js +16 -0
- data/app/assets/javascripts/resque_web/bootstrap.js.coffee +4 -0
- data/app/assets/javascripts/resque_web/failure.js.coffee +7 -0
- data/app/assets/javascripts/resque_web/jquery.relative-date.js +47 -0
- data/app/assets/javascripts/resque_web/polling.js.coffee +25 -0
- data/app/assets/javascripts/resque_web/relative_date.js.coffee +27 -0
- data/app/assets/stylesheets/resque_web/application.css +13 -0
- data/app/assets/stylesheets/resque_web/bootstrap_and_overrides.css.scss.erb +146 -0
- data/app/controllers/resque_web/application_controller.rb +26 -0
- data/app/controllers/resque_web/failures_controller.rb +62 -0
- data/app/controllers/resque_web/jobs_controller.rb +12 -0
- data/app/controllers/resque_web/overview_controller.rb +7 -0
- data/app/controllers/resque_web/queues_controller.rb +22 -0
- data/app/controllers/resque_web/stats_controller.rb +36 -0
- data/app/controllers/resque_web/workers_controller.rb +23 -0
- data/app/controllers/resque_web/working_controller.rb +8 -0
- data/app/helpers/resque_web/application_helper.rb +69 -0
- data/app/helpers/resque_web/failures_helper.rb +58 -0
- data/app/helpers/resque_web/overview_helper.rb +6 -0
- data/app/helpers/resque_web/queues_helper.rb +72 -0
- data/app/helpers/resque_web/stats_helper.rb +54 -0
- data/app/helpers/resque_web/workers_helper.rb +16 -0
- data/app/helpers/resque_web/working_helper.rb +19 -0
- data/app/views/layouts/resque_web/application.html.erb +75 -0
- data/app/views/resque_web/failures/_failed_job.html.erb +53 -0
- data/app/views/resque_web/failures/_overview.html.erb +24 -0
- data/app/views/resque_web/failures/index.html.erb +32 -0
- data/app/views/resque_web/failures/show.html.erb +20 -0
- data/app/views/resque_web/overview/show.html.erb +4 -0
- data/app/views/resque_web/queues/_queues.html.erb +4 -0
- data/app/views/resque_web/queues/_queues_advanced.html.erb +14 -0
- data/app/views/resque_web/queues/_queues_basic.html.erb +17 -0
- data/app/views/resque_web/queues/index.html.erb +1 -0
- data/app/views/resque_web/queues/show.html.erb +39 -0
- data/app/views/resque_web/stats/key.html.erb +26 -0
- data/app/views/resque_web/stats/keys.html.erb +17 -0
- data/app/views/resque_web/stats/redis.html.erb +14 -0
- data/app/views/resque_web/stats/resque.html.erb +14 -0
- data/app/views/resque_web/workers/index.html.erb +19 -0
- data/app/views/resque_web/workers/show.html.erb +38 -0
- data/app/views/resque_web/working/_working.html.erb +34 -0
- data/app/views/resque_web/working/index.html.erb +1 -0
- data/config/initializers/resque_config.rb +13 -0
- data/config/routes.rb +35 -0
- data/lib/resque_web.rb +4 -0
- data/lib/resque_web/engine.rb +13 -0
- data/lib/resque_web/version.rb +3 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/db/schema.rb +16 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/functional/failures_controller_test.rb +74 -0
- data/test/functional/jobs_controller_test.rb +45 -0
- data/test/functional/overview_controller_test.rb +37 -0
- data/test/functional/queues_controller_test.rb +58 -0
- data/test/functional/stats_controller_test.rb +70 -0
- data/test/functional/workers_controller_test.rb +26 -0
- data/test/functional/working_controller_test.rb +19 -0
- data/test/integration/plugin_integration_test.rb +72 -0
- data/test/support/controller_test_helpers.rb +22 -0
- data/test/test_helper.rb +26 -0
- data/test/unit/helpers/failures_helper_test.rb +15 -0
- data/test/unit/helpers/jobs_helper_test.rb +4 -0
- data/test/unit/helpers/overview_helper_test.rb +4 -0
- data/test/unit/helpers/queues_helper_test.rb +4 -0
- data/test/unit/helpers/retry_controller_helper_test.rb +4 -0
- data/test/unit/helpers/stats_helper_test.rb +4 -0
- data/test/unit/helpers/workers_helper_test.rb +4 -0
- data/test/unit/helpers/working_helper_test.rb +4 -0
- metadata +267 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Dummy::Application.config.secret_key_base = 'a7feb21f28a754e317f7e7656267efeb5c2665867f952e453e8731e7dc272c661fef7da3e0dff4736bef31674b323cdf75004a0991c89b87fc9be834db2223cc'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters :format => [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 0) do
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/404.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/422.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The change you wanted was rejected.</h1>
|
54
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/500.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>We're sorry, but something went wrong.</h1>
|
54
|
+
</div>
|
55
|
+
<p>If you are the application owner check the logs for more information.</p>
|
56
|
+
</body>
|
57
|
+
</html>
|
File without changes
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module ResqueWeb
|
4
|
+
class FailuresControllerTest < ActionController::TestCase
|
5
|
+
include ControllerTestHelpers
|
6
|
+
|
7
|
+
setup do
|
8
|
+
@routes = Engine.routes
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "GET /failures" do
|
12
|
+
it "renders the index page" do
|
13
|
+
visit(:index)
|
14
|
+
assert_template :index
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "DELETE /failures/:id" do
|
19
|
+
it "deletes the failure" do
|
20
|
+
Resque::Failure.expects(:remove).with('123')
|
21
|
+
visit(:destroy, {:id => 123}, :method => :delete)
|
22
|
+
assert_redirected_to failures_path
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "DELETE /failures/destroy_all" do
|
27
|
+
it "deletes all failures" do
|
28
|
+
Resque::Failure.expects(:clear).with('failed')
|
29
|
+
visit(:destroy_all, nil, :method => :delete)
|
30
|
+
assert_redirected_to failures_path
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "PUT /failures/:id/retry" do
|
35
|
+
it "retries the failure and remove the original message" do
|
36
|
+
Resque::Failure.expects(:requeue_and_remove).with('123')
|
37
|
+
visit(:retry, {:id => 123}, :method => :put)
|
38
|
+
assert_redirected_to failures_path
|
39
|
+
end
|
40
|
+
it "retries should work also in case of pre 2.0 Resque" do
|
41
|
+
Resque::Failure.expects(:requeue).with('123')
|
42
|
+
Resque::Failure.expects(:remove).with('123')
|
43
|
+
visit(:retry, {:id => 123}, :method => :put)
|
44
|
+
assert_redirected_to failures_path
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "PUT /failures/retry_all" do
|
49
|
+
it "retries all failures using requeue if no queue specified" do
|
50
|
+
Resque::Failure.stubs(:count).returns(2)
|
51
|
+
Resque::Failure.stubs(:requeue_and_remove).returns(true)
|
52
|
+
Resque::Failure.expects(:requeue_and_remove).with(0)
|
53
|
+
Resque::Failure.expects(:requeue_and_remove).with(1)
|
54
|
+
visit(:retry_all, nil, :method => :put)
|
55
|
+
assert_redirected_to failures_path
|
56
|
+
end
|
57
|
+
it "retries all failures should also work case of pre 2.0 Resque" do
|
58
|
+
Resque::Failure.stubs(:count).returns(2)
|
59
|
+
Resque::Failure.stubs(:requeue).returns(true)
|
60
|
+
Resque::Failure.expects(:requeue).with(0)
|
61
|
+
Resque::Failure.expects(:remove).with(0)
|
62
|
+
Resque::Failure.expects(:requeue).with(1)
|
63
|
+
Resque::Failure.expects(:remove).with(1)
|
64
|
+
visit(:retry_all, nil, :method => :put)
|
65
|
+
assert_redirected_to failures_path
|
66
|
+
end
|
67
|
+
it "retries all failures using requeue_queue if queue specified" do
|
68
|
+
Resque::Failure.expects(:requeue_queue).with('myqueue')
|
69
|
+
visit(:retry_all, {:queue=>"myqueue"}, :method => :put)
|
70
|
+
assert_redirected_to failures_path(:queue=>'myqueue')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module ResqueWeb
|
4
|
+
class JobsControllerTest < ActionController::TestCase
|
5
|
+
include ControllerTestHelpers
|
6
|
+
|
7
|
+
let(:queue_name) { 'example_queue' }
|
8
|
+
let(:args) { ['foo', 'bar'] }
|
9
|
+
let(:params) { { queue: queue_name, job_class: 'ExampleJob', args: JSON.dump(args)} }
|
10
|
+
|
11
|
+
setup do
|
12
|
+
@routes = Engine.routes
|
13
|
+
Resque.push(queue_name, class: 'ExampleJob', args: args)
|
14
|
+
@queue_size = Resque.size(queue_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
teardown do
|
18
|
+
Resque.remove_queue(queue_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "DELETE /destroy" do
|
22
|
+
let(:params_without_args) do
|
23
|
+
params.merge(:args => JSON.dump([]))
|
24
|
+
end
|
25
|
+
|
26
|
+
it "deletes a job having the specified arguments" do
|
27
|
+
visit(:destroy, params, method: :delete)
|
28
|
+
new_queue_size = Resque.size(queue_name)
|
29
|
+
assert_equal((@queue_size - 1), new_queue_size)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "deletes all jobs of a class if no args are specified" do
|
33
|
+
Resque.push(queue_name, class: 'ExampleJob')
|
34
|
+
visit(:destroy, params_without_args, method: :delete)
|
35
|
+
new_queue_size = Resque.size(queue_name)
|
36
|
+
assert_equal(0, new_queue_size)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "redirects to the queue's show page" do
|
40
|
+
visit(:destroy, params, method: :delete)
|
41
|
+
assert_redirected_to queue_path(queue_name)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module ResqueWeb
|
4
|
+
|
5
|
+
class OverviewControllerTest < ActionController::TestCase
|
6
|
+
include ControllerTestHelpers
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@routes = Engine.routes
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "GET /" do
|
13
|
+
describe "when HTTP Basic Authentication is enabled" do
|
14
|
+
describe "and the currect username and password are supplied " do
|
15
|
+
it "should grant me access" do
|
16
|
+
visit(:show)
|
17
|
+
assert_response :ok
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "and the username and password are not supplied" do
|
22
|
+
it "should deny me access" do
|
23
|
+
visit(:show, {}, :auth => false)
|
24
|
+
assert_response :unauthorized
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "when HTTP Basic Authentication is disabled" do
|
30
|
+
it "should grant me access" do
|
31
|
+
visit(:show, {}, :auth => :disabled)
|
32
|
+
assert_response :ok
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module ResqueWeb
|
4
|
+
class QueuesControllerTest < ActionController::TestCase
|
5
|
+
include ControllerTestHelpers
|
6
|
+
|
7
|
+
setup do
|
8
|
+
@routes = Engine.routes
|
9
|
+
@pending_before_push = Resque.info[:pending]
|
10
|
+
Resque.push(queue_name, class: 'ExampleJob')
|
11
|
+
end
|
12
|
+
|
13
|
+
teardown do
|
14
|
+
Resque.remove_queue(queue_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:queue_name) { 'example_queue' }
|
18
|
+
|
19
|
+
describe "GET /index" do
|
20
|
+
it "renders the index page" do
|
21
|
+
visit(:index)
|
22
|
+
assert_template :index
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "GET /show" do
|
27
|
+
it "renders the show page" do
|
28
|
+
visit(:show, id: queue_name)
|
29
|
+
assert_template :show
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "DELETE /destroy" do
|
34
|
+
it "deletes queues" do
|
35
|
+
visit(:destroy, {id: queue_name}, method: :delete)
|
36
|
+
assert_redirected_to queues_path
|
37
|
+
end
|
38
|
+
|
39
|
+
it "deletes queues" do
|
40
|
+
visit(:destroy, {id: queue_name}, method: :delete)
|
41
|
+
Resque.queues.include?(queue_name).wont_equal true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "PUT /clear" do
|
46
|
+
it "removes all pending jobs from a queue" do
|
47
|
+
visit(:clear, {id: queue_name}, method: :put)
|
48
|
+
pending_after_clear = Resque.info[:pending]
|
49
|
+
assert_equal @pending_before_push, pending_after_clear
|
50
|
+
end
|
51
|
+
|
52
|
+
it "redirects to the show page" do
|
53
|
+
visit(:clear, {id: queue_name}, method: :put)
|
54
|
+
assert_redirected_to queue_path(queue_name)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|