redis_web_manager 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.rspec +3 -0
- data/.rubocop.yml +17 -0
- data/.travis.yml +15 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +162 -0
- data/MIT-LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +28 -0
- data/app/assets/config/redis_web_manager_manifest.js +2 -0
- data/app/assets/javascripts/redis_web_manager/application.js +19 -0
- data/app/assets/javascripts/redis_web_manager/bootstrap.js +6 -0
- data/app/assets/javascripts/redis_web_manager/chartjs.js +7 -0
- data/app/assets/javascripts/redis_web_manager/dashboard.js +246 -0
- data/app/assets/javascripts/redis_web_manager/jquery.js +2 -0
- data/app/assets/javascripts/redis_web_manager/keys.js +14 -0
- data/app/assets/javascripts/redis_web_manager/popper.js +4 -0
- data/app/assets/stylesheets/redis_web_manager/application.css +15 -0
- data/app/assets/stylesheets/redis_web_manager/bootstrap.css +6 -0
- data/app/assets/stylesheets/redis_web_manager/dashboard.css +28 -0
- data/app/controllers/redis_web_manager/actions_controller.rb +11 -0
- data/app/controllers/redis_web_manager/application_controller.rb +31 -0
- data/app/controllers/redis_web_manager/clients_controller.rb +12 -0
- data/app/controllers/redis_web_manager/configuration_controller.rb +12 -0
- data/app/controllers/redis_web_manager/dashboard_controller.rb +14 -0
- data/app/controllers/redis_web_manager/information_controller.rb +18 -0
- data/app/helpers/redis_web_manager/application_helper.rb +13 -0
- data/app/helpers/redis_web_manager/clients_helper.rb +35 -0
- data/app/helpers/redis_web_manager/dashboard_helper.rb +20 -0
- data/app/views/layouts/redis_web_manager/application.html.erb +17 -0
- data/app/views/redis_web_manager/clients/index.html.erb +58 -0
- data/app/views/redis_web_manager/configuration/index.html.erb +24 -0
- data/app/views/redis_web_manager/dashboard/index.html.erb +49 -0
- data/app/views/redis_web_manager/information/index.html.erb +24 -0
- data/app/views/redis_web_manager/shared/_header.html.erb +49 -0
- data/app/views/redis_web_manager/shared/_status.html.erb +6 -0
- data/bin/rails +20 -0
- data/config/routes.rb +19 -0
- data/gemfiles/Gemfile-5-2 +5 -0
- data/gemfiles/Gemfile-6-0 +5 -0
- data/lib/redis_web_manager.rb +35 -0
- data/lib/redis_web_manager/action.rb +21 -0
- data/lib/redis_web_manager/base.rb +11 -0
- data/lib/redis_web_manager/connection.rb +31 -0
- data/lib/redis_web_manager/data.rb +55 -0
- data/lib/redis_web_manager/engine.rb +21 -0
- data/lib/redis_web_manager/info.rb +69 -0
- data/lib/redis_web_manager/version.rb +5 -0
- data/redis_web_manager.gemspec +42 -0
- data/spec/controllers/redis_web_manager/actions_controller_spec.rb +13 -0
- data/spec/controllers/redis_web_manager/application_controller_spec.rb +29 -0
- data/spec/controllers/redis_web_manager/clients_controller_spec.rb +14 -0
- data/spec/controllers/redis_web_manager/configuration_controller_spec.rb +14 -0
- data/spec/controllers/redis_web_manager/dashboard_controller_spec.rb +14 -0
- data/spec/controllers/redis_web_manager/information_controller_spec.rb +14 -0
- data/spec/dummy/Rakefile +8 -0
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +14 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/bin/bundle +5 -0
- data/spec/dummy/bin/rails +6 -0
- data/spec/dummy/bin/rake +6 -0
- data/spec/dummy/bin/setup +27 -0
- data/spec/dummy/bin/update +27 -0
- data/spec/dummy/config.ru +7 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +7 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +49 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +38 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +9 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +8 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +26 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/spec/dummy/config/initializers/inflections.rb +17 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +11 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +39 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/config/spring.rb +8 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/application_helper_spec.rb +15 -0
- data/spec/helpers/clients_helper_spec.rb +19 -0
- data/spec/helpers/dashboard_helper_spec.rb +15 -0
- data/spec/rails_helper.rb +50 -0
- data/spec/redis_web_manager_action_spec.rb +33 -0
- data/spec/redis_web_manager_connection_spec.rb +33 -0
- data/spec/redis_web_manager_info_spec.rb +90 -0
- data/spec/redis_web_manager_spec.rb +57 -0
- data/spec/routing/actions_controller_spec.rb +21 -0
- data/spec/routing/clients_controller_spec.rb +15 -0
- data/spec/routing/configuration_controller_spec.rb +15 -0
- data/spec/routing/dashboard_controller_spec.rb +15 -0
- data/spec/spec_helper.rb +96 -0
- metadata +619 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Be sure to restart your server when you modify this file.
|
|
4
|
+
|
|
5
|
+
# Specify a serializer for the signed and encrypted cookie jars.
|
|
6
|
+
# Valid options are :json, :marshal, and :hybrid.
|
|
7
|
+
Rails.application.config.action_dispatch.cookies_serializer = :json
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Be sure to restart your server when you modify this file.
|
|
3
|
+
|
|
4
|
+
# Add new inflection rules using the following format. Inflections
|
|
5
|
+
# are locale specific, and you may define rules for as many different
|
|
6
|
+
# locales as you wish. All of these examples are active by default:
|
|
7
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
8
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
|
9
|
+
# inflect.singular /^(ox)en/i, '\1'
|
|
10
|
+
# inflect.irregular 'person', 'people'
|
|
11
|
+
# inflect.uncountable %w( fish sheep )
|
|
12
|
+
# end
|
|
13
|
+
|
|
14
|
+
# These inflection rules are supported but not enabled by default:
|
|
15
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
16
|
+
# inflect.acronym 'RESTful'
|
|
17
|
+
# end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Be sure to restart your server when you modify this file.
|
|
4
|
+
|
|
5
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
|
6
|
+
# is enabled by default.
|
|
7
|
+
|
|
8
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
|
9
|
+
ActiveSupport.on_load(:action_controller) do
|
|
10
|
+
wrap_parameters format: [:json]
|
|
11
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
# The following keys must be escaped otherwise they will not be retrieved by
|
|
20
|
+
# the default I18n backend:
|
|
21
|
+
#
|
|
22
|
+
# true, false, on, off, yes, no
|
|
23
|
+
#
|
|
24
|
+
# Instead, surround them with single quotes.
|
|
25
|
+
#
|
|
26
|
+
# en:
|
|
27
|
+
# 'true': 'foo'
|
|
28
|
+
#
|
|
29
|
+
# To learn more, please read the Rails Internationalization guide
|
|
30
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
|
31
|
+
|
|
32
|
+
en:
|
|
33
|
+
hello: "Hello world"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
|
4
|
+
# The `threads` method setting takes two numbers: a minimum and maximum.
|
|
5
|
+
# Any libraries that use thread pools should be configured to match
|
|
6
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
|
7
|
+
# and maximum; this matches the default thread size of Active Record.
|
|
8
|
+
#
|
|
9
|
+
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
|
|
10
|
+
threads threads_count, threads_count
|
|
11
|
+
|
|
12
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
|
13
|
+
#
|
|
14
|
+
port ENV.fetch('PORT') { 3000 }
|
|
15
|
+
|
|
16
|
+
# Specifies the `environment` that Puma will run in.
|
|
17
|
+
#
|
|
18
|
+
environment ENV.fetch('RAILS_ENV') { 'development' }
|
|
19
|
+
|
|
20
|
+
# Specifies the `pidfile` that Puma will use.
|
|
21
|
+
pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' }
|
|
22
|
+
|
|
23
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
|
24
|
+
# Workers are forked webserver processes. If using threads and workers together
|
|
25
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
|
26
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
|
27
|
+
# processes).
|
|
28
|
+
#
|
|
29
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
|
30
|
+
|
|
31
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
|
32
|
+
# This directive tells Puma to first boot the application and load code
|
|
33
|
+
# before forking the application. This takes advantage of Copy On Write
|
|
34
|
+
# process behavior so workers use less memory.
|
|
35
|
+
#
|
|
36
|
+
# preload_app!
|
|
37
|
+
|
|
38
|
+
# Allow puma to be restarted by `rails restart` command.
|
|
39
|
+
plugin :tmp_restart
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
.rails-default-error-page {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
|
+
<!-- This file lives in public/404.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
.rails-default-error-page {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
|
+
<!-- This file lives in public/422.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
.rails-default-error-page {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
|
+
<!-- This file lives in public/500.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
62
|
+
</div>
|
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
64
|
+
</div>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rails_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe RedisWebManager::ApplicationHelper, type: :helper do
|
|
6
|
+
describe 'helper' do
|
|
7
|
+
it 'returns a no expiration' do
|
|
8
|
+
expect(helper.expire(-1)).to eql('No expiration date')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'returns a expiration' do
|
|
12
|
+
expect(helper.expire(86_400)).to eql('1 day')
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rails_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe RedisWebManager::ClientsHelper, type: :helper do
|
|
6
|
+
describe 'helper' do
|
|
7
|
+
it 'returns age value' do
|
|
8
|
+
expect(helper.age(86_400)).to eql('1 day')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'returns flags value' do
|
|
12
|
+
expect(helper.flags(:A)).to eql('Connection to be closed ASAP')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'returns events value' do
|
|
16
|
+
expect(helper.events(:r)).to eql('The client socket is readable')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rails_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe RedisWebManager::DashboardHelper, type: :helper do
|
|
6
|
+
describe 'helper' do
|
|
7
|
+
it 'returns graph_canvas tag (div)' do
|
|
8
|
+
expect(helper.graph_canvas(nil, :test)).to match(/div/)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'returns graph_canvas tag (canvas)' do
|
|
12
|
+
expect(helper.graph_canvas([1], :test)).to match(/canvas/)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
4
|
+
require 'spec_helper'
|
|
5
|
+
ENV['RAILS_ENV'] ||= 'test'
|
|
6
|
+
|
|
7
|
+
require File.expand_path('dummy/config/environment.rb', __dir__)
|
|
8
|
+
|
|
9
|
+
# Prevent database truncation if the environment is production
|
|
10
|
+
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
|
11
|
+
|
|
12
|
+
require 'rspec/rails'
|
|
13
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
|
14
|
+
|
|
15
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
16
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
17
|
+
# run as spec files by default. This means that files in spec/support that end
|
|
18
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
19
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
|
20
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
|
21
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
|
22
|
+
#
|
|
23
|
+
# The following line is provided for convenience purposes. It has the downside
|
|
24
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
|
25
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
|
26
|
+
# require only the support files necessary.
|
|
27
|
+
#
|
|
28
|
+
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
|
29
|
+
|
|
30
|
+
RSpec.configure do |config|
|
|
31
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
|
32
|
+
# based on their file location, for example enabling you to call `get` and
|
|
33
|
+
# `post` in specs under `spec/controllers`.
|
|
34
|
+
#
|
|
35
|
+
# You can disable this behaviour by removing the line below, and instead
|
|
36
|
+
# explicitly tag your specs with their type, e.g.:
|
|
37
|
+
#
|
|
38
|
+
# RSpec.describe UsersController, :type => :controller do
|
|
39
|
+
# # ...
|
|
40
|
+
# end
|
|
41
|
+
#
|
|
42
|
+
# The different available types are documented in the features, such as in
|
|
43
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
|
44
|
+
config.infer_spec_type_from_file_location!
|
|
45
|
+
|
|
46
|
+
# Filter lines from Rails gems in backtraces.
|
|
47
|
+
config.filter_rails_from_backtrace!
|
|
48
|
+
# arbitrary gems may also be filtered via:
|
|
49
|
+
# config.filter_gems_from_backtrace("gem name")
|
|
50
|
+
end
|