rvt 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +25 -0
- data/app/assets/javascripts/rvt/application.js +1 -0
- data/app/assets/javascripts/rvt/console_sessions.js +182 -0
- data/app/assets/stylesheets/rvt/application.css +13 -0
- data/app/assets/stylesheets/rvt/console_sessions.css.erb +6 -0
- data/app/controllers/rvt/application_controller.rb +13 -0
- data/app/controllers/rvt/console_sessions_controller.rb +47 -0
- data/app/models/rvt/console_session.rb +109 -0
- data/app/views/layouts/rvt/application.html.erb +14 -0
- data/app/views/rvt/console_sessions/index.html.erb +17 -0
- data/config/routes.rb +11 -0
- data/lib/assets/javascripts/rvt.js +41 -0
- data/lib/rvt.rb +21 -0
- data/lib/rvt/colors.rb +87 -0
- data/lib/rvt/colors/light.rb +24 -0
- data/lib/rvt/colors/monokai.rb +24 -0
- data/lib/rvt/colors/solarized.rb +47 -0
- data/lib/rvt/colors/tango.rb +24 -0
- data/lib/rvt/colors/xterm.rb +24 -0
- data/lib/rvt/engine.rb +85 -0
- data/lib/rvt/slave.rb +147 -0
- data/lib/rvt/version.rb +3 -0
- data/test/controllers/rvt/console_sessions_controller_test.rb +100 -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/controller_helper_test/index.html.erb +1 -0
- data/test/dummy/app/views/exception_test/xhr.html.erb +1 -0
- data/test/dummy/app/views/helper_test/index.html.erb +220 -0
- data/test/dummy/app/views/layouts/application.html.erb +16 -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 +44 -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 +34 -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 +2 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +16 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +247222 -0
- data/test/dummy/log/test.log +963 -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/dummy/tmp/cache/assets/development/sprockets/0509a6e0e75d9ac5a88bba7291b04686 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2bd9d10dae311aa2dfb6dea9c1e0ad50 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f41a6a41d0a16db31cabd2b8689ca00 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4de66e84a0d6f009fac50cd608fb8581 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/56e8026311075410507152df2aea4307 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9542de15712d45f70221931bf78c00e5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/98cea396a602c53d876e79bf4b89de3b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9df3968b0f171feec749766fffa50b2e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/aa5fc4cb46c5294192c9d3af8824f88b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ac7197dc7dd9ab362d915d19e37a8e01 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b238befd6eff46b26d56322c1450ea45 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c69b8b79c21fd48ad84c3fad87945a5c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/da4318a4d8364d0616edd706508371bc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/dd71b14df42fd6dc95355cded9e4d0f9 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/eb06cae1627276e46965809e766aff13 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/edffb5017d27ddb65965203636286405 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f0ced5f3d4a75fce1c596d6c3f97a42d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/fb9e611526e612ba797f0c11b987826b +0 -0
- data/test/models/console_session_test.rb +58 -0
- data/test/rvt/colors_test.rb +58 -0
- data/test/rvt/engine_test.rb +145 -0
- data/test/rvt/slave_test.rb +72 -0
- data/test/test_helper.rb +27 -0
- data/vendor/assets/javascripts/term.js +5771 -0
- metadata +284 -0
@@ -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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module RVT
|
4
|
+
class ConsoleSessionTest < ActionView::TestCase
|
5
|
+
include ActiveModel::Lint::Tests
|
6
|
+
|
7
|
+
setup do
|
8
|
+
PTY.stubs(:spawn).returns([StringIO.new, StringIO.new, Random.rand(20000)])
|
9
|
+
ConsoleSession::INMEMORY_STORAGE.clear
|
10
|
+
@model1 = @model = ConsoleSession.new
|
11
|
+
@model2 = ConsoleSession.new
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'raises ConsoleSession::Unavailable on not found sessions' do
|
15
|
+
assert_raises(ConsoleSession::Unavailable) { ConsoleSession.find(-1) }
|
16
|
+
end
|
17
|
+
|
18
|
+
test 'find coerces ids' do
|
19
|
+
assert_equal @model.persist, ConsoleSession.find("#{@model.pid}")
|
20
|
+
end
|
21
|
+
|
22
|
+
test 'not found exceptions are JSON serializable' do
|
23
|
+
exception = assert_raises(ConsoleSession::Unavailable) { ConsoleSession.find(-1) }
|
24
|
+
assert_equal '{"error":"Session unavailable"}', exception.to_json
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'can be used as slave as the methods are delegated' do
|
28
|
+
slave_methods = Slave.instance_methods - @model.methods
|
29
|
+
slave_methods.each { |method| assert @model.respond_to?(method) }
|
30
|
+
end
|
31
|
+
|
32
|
+
test 'slave methods are cached on the singleton' do
|
33
|
+
assert_not @model.singleton_methods.include?(:pending_output?)
|
34
|
+
@model.pending_output? rescue nil
|
35
|
+
assert @model.singleton_methods.include?(:pending_output?)
|
36
|
+
end
|
37
|
+
|
38
|
+
test 'persisted models knows that they are in memory' do
|
39
|
+
assert_not @model.persisted?
|
40
|
+
@model.persist
|
41
|
+
assert @model.persisted?
|
42
|
+
end
|
43
|
+
|
44
|
+
test 'persisted models knows about their keys' do
|
45
|
+
assert_nil @model.to_key
|
46
|
+
@model.persist
|
47
|
+
assert_not_nil @model.to_key
|
48
|
+
end
|
49
|
+
|
50
|
+
test 'create gives already persisted models' do
|
51
|
+
assert ConsoleSession.create.persisted?
|
52
|
+
end
|
53
|
+
|
54
|
+
test 'no gives not persisted models' do
|
55
|
+
assert_not ConsoleSession.new.persisted?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module RVT
|
4
|
+
class ColorsTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
@colors = Colors.new %w( #7f7f7f #ff0000 #00ff00 #ffff00 #5c5cff #ff00ff #00ffff #ffffff )
|
7
|
+
end
|
8
|
+
|
9
|
+
test '.[] is an alias for .themes#[]' do
|
10
|
+
@colors.class.themes.expects(:[]).with(:light).once
|
11
|
+
@colors.class[:light]
|
12
|
+
end
|
13
|
+
|
14
|
+
test '.register_theme creates Colors instance for the block' do
|
15
|
+
@colors.class.register_theme(:test) { |c| assert c.is_a?(Colors) }
|
16
|
+
end
|
17
|
+
|
18
|
+
test '#background is the first color if not specified' do
|
19
|
+
assert_equal '#7f7f7f', @colors.background
|
20
|
+
end
|
21
|
+
|
22
|
+
test '#background can be explicitly specified' do
|
23
|
+
@colors.background '#00ff00'
|
24
|
+
assert_equal '#00ff00', @colors.background
|
25
|
+
end
|
26
|
+
|
27
|
+
test '#background= is an alias of #background' do
|
28
|
+
@colors.background = '#00ff00'
|
29
|
+
assert_equal '#00ff00', @colors.background
|
30
|
+
end
|
31
|
+
|
32
|
+
test '#foreground is the last color if not specified' do
|
33
|
+
assert_equal '#ffffff', @colors.foreground
|
34
|
+
end
|
35
|
+
|
36
|
+
test '#foreground can be explicitly specified' do
|
37
|
+
@colors.foreground '#f0f0f0'
|
38
|
+
assert_equal '#f0f0f0', @colors.foreground
|
39
|
+
end
|
40
|
+
|
41
|
+
test '#foreground= is an alias of #foreground' do
|
42
|
+
@colors.foreground = '#f0f0f0'
|
43
|
+
assert_equal '#f0f0f0', @colors.foreground
|
44
|
+
end
|
45
|
+
|
46
|
+
test '#to_json includes the background and the foreground' do
|
47
|
+
@colors.background = '#00ff00'
|
48
|
+
@colors.foreground = '#f0f0f0'
|
49
|
+
|
50
|
+
expected_json = '["#7f7f7f","#ff0000","#00ff00","#ffff00","#5c5cff","#ff00ff","#00ffff","#ffffff","#00ff00","#f0f0f0"]'
|
51
|
+
assert_equal expected_json, @colors.to_json
|
52
|
+
end
|
53
|
+
|
54
|
+
test '#default is :light' do
|
55
|
+
assert_equal @colors.class.default, @colors.class.themes[:light]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module RVT
|
4
|
+
class EngineTest < ActiveSupport::TestCase
|
5
|
+
test 'custom default_mount_path' do
|
6
|
+
new_uninitialized_app do |app|
|
7
|
+
app.config.rvt.default_mount_path = '/shell'
|
8
|
+
app.initialize!
|
9
|
+
|
10
|
+
assert app.routes.named_routes['rvt'].path.match('/shell')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'disabling automounting' do
|
15
|
+
new_uninitialized_app do |app|
|
16
|
+
app.config.rvt.automount = false
|
17
|
+
app.initialize!
|
18
|
+
|
19
|
+
assert_not app.routes.named_routes['rvt']
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
test 'blank commands are expanded to the rails console' do
|
24
|
+
new_uninitialized_app do |app|
|
25
|
+
app.config.rvt.command = ' '
|
26
|
+
app.initialize!
|
27
|
+
|
28
|
+
expected_path = Rails.root.join('bin/rails console').to_s
|
29
|
+
assert_equal expected_path, app.config.rvt.command
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
test 'present commands are not processed' do
|
34
|
+
new_uninitialized_app do |app|
|
35
|
+
app.config.rvt.command = '/bin/login'
|
36
|
+
app.initialize!
|
37
|
+
|
38
|
+
assert_equal '/bin/login', app.config.rvt.command
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
test 'whitelisted ips are courced to IPAddr' do
|
43
|
+
new_uninitialized_app do |app|
|
44
|
+
app.config.rvt.whitelisted_ips = '127.0.0.1'
|
45
|
+
app.initialize!
|
46
|
+
|
47
|
+
assert_equal [ IPAddr.new('127.0.0.1') ], app.config.rvt.whitelisted_ips
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
test 'whitelisted ips with IPv6 format as default' do
|
52
|
+
new_uninitialized_app do |app|
|
53
|
+
app.config.rvt.whitelisted_ips = [ '127.0.0.1', '::1' ]
|
54
|
+
app.initialize!
|
55
|
+
|
56
|
+
assert_equal [ IPAddr.new('127.0.0.1'), IPAddr.new('::1') ], app.config.rvt.whitelisted_ips
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
test 'whitelisted ips are normalized and unique IPAddr' do
|
61
|
+
new_uninitialized_app do |app|
|
62
|
+
app.config.rvt.whitelisted_ips = [ '127.0.0.1', '127.0.0.1', nil, '', ' ' ]
|
63
|
+
app.initialize!
|
64
|
+
|
65
|
+
assert_equal [ IPAddr.new('127.0.0.1') ], app.config.rvt.whitelisted_ips
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
test 'whitelisted_ips.include? coerces to IPAddr' do
|
70
|
+
new_uninitialized_app do |app|
|
71
|
+
app.config.rvt.whitelisted_ips = '127.0.0.1'
|
72
|
+
app.initialize!
|
73
|
+
|
74
|
+
assert app.config.rvt.whitelisted_ips.include?('127.0.0.1')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
test 'whitelisted_ips.include? works with IPAddr' do
|
79
|
+
new_uninitialized_app do |app|
|
80
|
+
app.config.rvt.whitelisted_ips = '127.0.0.1'
|
81
|
+
app.initialize!
|
82
|
+
|
83
|
+
assert app.config.rvt.whitelisted_ips.include?(IPAddr.new('127.0.0.1'))
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
test 'whitelist whole networks' do
|
88
|
+
new_uninitialized_app do |app|
|
89
|
+
app.config.rvt.whitelisted_ips = '172.16.0.0/12'
|
90
|
+
app.initialize!
|
91
|
+
|
92
|
+
1.upto(255).each do |n|
|
93
|
+
assert_includes app.config.rvt.whitelisted_ips, "172.16.0.#{n}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
test 'whitelist multiple networks' do
|
99
|
+
new_uninitialized_app do |app|
|
100
|
+
app.config.rvt.whitelisted_ips = %w( 172.16.0.0/12 192.168.0.0/16 )
|
101
|
+
app.initialize!
|
102
|
+
|
103
|
+
1.upto(255).each do |n|
|
104
|
+
assert_includes app.config.rvt.whitelisted_ips, "172.16.0.#{n}"
|
105
|
+
assert_includes app.config.rvt.whitelisted_ips, "192.168.0.#{n}"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
def new_uninitialized_app(root = File.expand_path('../../dummy', __FILE__))
|
113
|
+
skip if Rails::VERSION::MAJOR == 3
|
114
|
+
|
115
|
+
old_app = Rails.application
|
116
|
+
|
117
|
+
FileUtils.mkdir_p(root)
|
118
|
+
Dir.chdir(root) do
|
119
|
+
Rails.application = nil
|
120
|
+
|
121
|
+
app = Class.new(Rails::Application)
|
122
|
+
app.config.eager_load = false
|
123
|
+
app.config.time_zone = 'UTC'
|
124
|
+
app.config.middleware ||= Rails::Configuration::MiddlewareStackProxy.new
|
125
|
+
app.config.active_support.deprecation = :notify
|
126
|
+
|
127
|
+
yield app
|
128
|
+
end
|
129
|
+
ensure
|
130
|
+
Rails.application = old_app
|
131
|
+
end
|
132
|
+
|
133
|
+
def teardown_fixtures(*)
|
134
|
+
super
|
135
|
+
rescue
|
136
|
+
# This is nasty hack to prevent a connection to the database in JRuby's
|
137
|
+
# activerecord-jdbcsqlite3-adapter. We don't really require a database
|
138
|
+
# connection, for the tests to run.
|
139
|
+
#
|
140
|
+
# The sad thing is that I couldn't figure out why does it only happens
|
141
|
+
# on activerecord-jdbcsqlite3-adapter and how to actually prevent it,
|
142
|
+
# rather than work-around it.
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|