tainted_love 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/probots.yml +2 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +1188 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +73 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +57 -0
- data/LICENSE.txt +21 -0
- data/README.md +85 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +10 -0
- data/bin/test +7 -0
- data/dev.yml +28 -0
- data/docs/TaintedLove.html +482 -0
- data/docs/TaintedLove/Configuration.html +499 -0
- data/docs/TaintedLove/Replacer.html +129 -0
- data/docs/TaintedLove/Replacer/ActionViewHelpersMod.html +230 -0
- data/docs/TaintedLove/Replacer/Base.html +320 -0
- data/docs/TaintedLove/Replacer/HelperMod.html +226 -0
- data/docs/TaintedLove/Replacer/HelpersMod.html +230 -0
- data/docs/TaintedLove/Replacer/MarshalMod.html +178 -0
- data/docs/TaintedLove/Replacer/ObjectMod.html +282 -0
- data/docs/TaintedLove/Replacer/ReplaceActionController.html +329 -0
- data/docs/TaintedLove/Replacer/ReplaceActionView.html +317 -0
- data/docs/TaintedLove/Replacer/ReplaceActiveRecord.html +341 -0
- data/docs/TaintedLove/Replacer/ReplaceDigest.html +369 -0
- data/docs/TaintedLove/Replacer/ReplaceFile.html +245 -0
- data/docs/TaintedLove/Replacer/ReplaceKernel.html +211 -0
- data/docs/TaintedLove/Replacer/ReplaceMarshal.html +219 -0
- data/docs/TaintedLove/Replacer/ReplaceObject.html +231 -0
- data/docs/TaintedLove/Replacer/ReplaceRailsUserInput.html +374 -0
- data/docs/TaintedLove/Replacer/ReplaceSprokets.html +297 -0
- data/docs/TaintedLove/Replacer/SprocketsHelperMod.html +226 -0
- data/docs/TaintedLove/Reporter.html +117 -0
- data/docs/TaintedLove/Reporter/Base.html +466 -0
- data/docs/TaintedLove/Reporter/RackReporter.html +309 -0
- data/docs/TaintedLove/Reporter/SinatraReporter.html +402 -0
- data/docs/TaintedLove/Reporter/SinatraReporter/App.html +210 -0
- data/docs/TaintedLove/Reporter/StdoutReporter.html +305 -0
- data/docs/TaintedLove/SinatraReporter.html +387 -0
- data/docs/TaintedLove/SinatraReporter/App.html +210 -0
- data/docs/TaintedLove/StackTrace.html +650 -0
- data/docs/TaintedLove/Utils.html +550 -0
- data/docs/TaintedLove/Validator.html +129 -0
- data/docs/TaintedLove/Validator/ActionViewObjectSend.html +233 -0
- data/docs/TaintedLove/Validator/Base.html +200 -0
- data/docs/TaintedLove/Validator/ErbEval.html +229 -0
- data/docs/TaintedLove/Validator/RedisStoreSerialization.html +238 -0
- data/docs/TaintedLove/Validator/SproketsMarshal.html +233 -0
- data/docs/TaintedLove/Warning.html +665 -0
- data/docs/_index.html +371 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +496 -0
- data/docs/file.README.html +134 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +134 -0
- data/docs/js/app.js +292 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +523 -0
- data/docs/top-level-namespace.html +110 -0
- data/example/.gitignore +31 -0
- data/example/.ruby-version +1 -0
- data/example/Gemfile +67 -0
- data/example/Gemfile.lock +226 -0
- data/example/README.md +24 -0
- data/example/Rakefile +8 -0
- data/example/app/assets/config/manifest.js +3 -0
- data/example/app/assets/images/.keep +0 -0
- data/example/app/assets/javascripts/application.js +16 -0
- data/example/app/assets/javascripts/cable.js +13 -0
- data/example/app/assets/javascripts/channels/.keep +0 -0
- data/example/app/assets/javascripts/products.coffee +3 -0
- data/example/app/assets/stylesheets/application.css +15 -0
- data/example/app/assets/stylesheets/products.scss +3 -0
- data/example/app/assets/stylesheets/scaffolds.scss +84 -0
- data/example/app/channels/application_cable/channel.rb +6 -0
- data/example/app/channels/application_cable/connection.rb +6 -0
- data/example/app/controllers/application_controller.rb +4 -0
- data/example/app/controllers/concerns/.keep +0 -0
- data/example/app/controllers/products_controller.rb +77 -0
- data/example/app/controllers/test_cases_controller.rb +20 -0
- data/example/app/helpers/application_helper.rb +4 -0
- data/example/app/helpers/products_helper.rb +4 -0
- data/example/app/helpers/test_cases_helper.rb +4 -0
- data/example/app/jobs/application_job.rb +4 -0
- data/example/app/mailers/application_mailer.rb +6 -0
- data/example/app/models/application_record.rb +5 -0
- data/example/app/models/concerns/.keep +0 -0
- data/example/app/models/product.rb +4 -0
- data/example/app/views/layouts/application.html.erb +15 -0
- data/example/app/views/layouts/mailer.html.erb +13 -0
- data/example/app/views/layouts/mailer.text.erb +1 -0
- data/example/app/views/products/_form.html.erb +32 -0
- data/example/app/views/products/_product.json.jbuilder +4 -0
- data/example/app/views/products/edit.html.erb +6 -0
- data/example/app/views/products/index.html.erb +31 -0
- data/example/app/views/products/index.json.jbuilder +3 -0
- data/example/app/views/products/new.html.erb +5 -0
- data/example/app/views/products/show.html.erb +19 -0
- data/example/app/views/products/show.json.jbuilder +3 -0
- data/example/app/views/test_cases/xss.html.erb +10 -0
- data/example/bin/bundle +5 -0
- data/example/bin/rails +11 -0
- data/example/bin/rake +11 -0
- data/example/bin/setup +38 -0
- data/example/bin/spring +18 -0
- data/example/bin/update +33 -0
- data/example/bin/yarn +11 -0
- data/example/config.ru +7 -0
- data/example/config/application.rb +21 -0
- data/example/config/boot.rb +6 -0
- data/example/config/cable.yml +10 -0
- data/example/config/credentials.yml.enc +1 -0
- data/example/config/database.yml +25 -0
- data/example/config/environment.rb +7 -0
- data/example/config/environments/development.rb +63 -0
- data/example/config/environments/production.rb +96 -0
- data/example/config/environments/test.rb +48 -0
- data/example/config/initializers/application_controller_renderer.rb +10 -0
- data/example/config/initializers/assets.rb +16 -0
- data/example/config/initializers/backtrace_silencers.rb +9 -0
- data/example/config/initializers/content_security_policy.rb +27 -0
- data/example/config/initializers/cookies_serializer.rb +7 -0
- data/example/config/initializers/filter_parameter_logging.rb +6 -0
- data/example/config/initializers/inflections.rb +18 -0
- data/example/config/initializers/mime_types.rb +6 -0
- data/example/config/initializers/tainted_love.rb +7 -0
- data/example/config/initializers/wrap_parameters.rb +16 -0
- data/example/config/locales/en.yml +33 -0
- data/example/config/puma.rb +36 -0
- data/example/config/routes.rb +10 -0
- data/example/config/spring.rb +8 -0
- data/example/config/storage.yml +34 -0
- data/example/db/migrate/20190311220346_create_products.rb +13 -0
- data/example/db/schema.rb +23 -0
- data/example/db/seeds.rb +9 -0
- data/example/lib/assets/.keep +0 -0
- data/example/lib/tasks/.keep +0 -0
- data/example/log/.keep +0 -0
- data/example/package.json +5 -0
- data/example/public/404.html +67 -0
- data/example/public/422.html +67 -0
- data/example/public/500.html +66 -0
- data/example/public/apple-touch-icon-precomposed.png +0 -0
- data/example/public/apple-touch-icon.png +0 -0
- data/example/public/favicon.ico +0 -0
- data/example/public/robots.txt +1 -0
- data/example/storage/.keep +0 -0
- data/example/test/application_system_test_case.rb +7 -0
- data/example/test/controllers/.keep +0 -0
- data/example/test/controllers/products_controller_test.rb +66 -0
- data/example/test/controllers/test_cases_controller_test.rb +39 -0
- data/example/test/fixtures/.keep +0 -0
- data/example/test/fixtures/files/.keep +0 -0
- data/example/test/fixtures/products.yml +11 -0
- data/example/test/helpers/.keep +0 -0
- data/example/test/integration/.keep +0 -0
- data/example/test/mailers/.keep +0 -0
- data/example/test/models/.keep +0 -0
- data/example/test/models/product_test.rb +9 -0
- data/example/test/replacers/replace_active_record_test.rb +31 -0
- data/example/test/replacers/replace_sprokets_test.rb +8 -0
- data/example/test/system/.keep +0 -0
- data/example/test/system/products_test.rb +49 -0
- data/example/test/test_helper.rb +37 -0
- data/example/tmp/.keep +0 -0
- data/example/vendor/.keep +0 -0
- data/lib/tainted_love.rb +57 -0
- data/lib/tainted_love/configuration.rb +16 -0
- data/lib/tainted_love/replacer/base.rb +25 -0
- data/lib/tainted_love/replacer/replace_action_controller.rb +61 -0
- data/lib/tainted_love/replacer/replace_action_view.rb +39 -0
- data/lib/tainted_love/replacer/replace_active_record.rb +47 -0
- data/lib/tainted_love/replacer/replace_digest.rb +39 -0
- data/lib/tainted_love/replacer/replace_file.rb +32 -0
- data/lib/tainted_love/replacer/replace_kernel.rb +44 -0
- data/lib/tainted_love/replacer/replace_marshal.rb +19 -0
- data/lib/tainted_love/replacer/replace_object.rb +30 -0
- data/lib/tainted_love/replacer/replace_rails_user_input.rb +59 -0
- data/lib/tainted_love/replacer/replace_sprokets.rb +25 -0
- data/lib/tainted_love/replacer/replace_yaml.rb +28 -0
- data/lib/tainted_love/reporter/base.rb +47 -0
- data/lib/tainted_love/reporter/file_reporter.rb +28 -0
- data/lib/tainted_love/reporter/stdout_reporter.rb +30 -0
- data/lib/tainted_love/stack_trace.rb +46 -0
- data/lib/tainted_love/utils.rb +80 -0
- data/lib/tainted_love/validator/action_view_object_send.rb +15 -0
- data/lib/tainted_love/validator/base.rb +16 -0
- data/lib/tainted_love/validator/erb_eval.rb +13 -0
- data/lib/tainted_love/validator/redis_store_serialization.rb +13 -0
- data/lib/tainted_love/validator/sprokets_marshal.rb +15 -0
- data/lib/tainted_love/version.rb +5 -0
- data/lib/tainted_love/warning.rb +30 -0
- data/tainted_love.gemspec +31 -0
- metadata +315 -0
@@ -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 @@
|
|
1
|
+
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
File without changes
|
File without changes
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class ProductsControllerTest < ActionDispatch::IntegrationTest
|
6
|
+
setup do
|
7
|
+
@product = products(:one)
|
8
|
+
end
|
9
|
+
|
10
|
+
test "should get index" do
|
11
|
+
get products_url
|
12
|
+
assert_response :success
|
13
|
+
end
|
14
|
+
|
15
|
+
test "should get new" do
|
16
|
+
get new_product_url
|
17
|
+
assert_response :success
|
18
|
+
end
|
19
|
+
|
20
|
+
test "should create product" do
|
21
|
+
assert_difference('Product.count') do
|
22
|
+
params = {
|
23
|
+
product: {
|
24
|
+
description: @product.description,
|
25
|
+
name: @product.name,
|
26
|
+
price: @product.price,
|
27
|
+
},
|
28
|
+
}
|
29
|
+
|
30
|
+
post products_url, params: params
|
31
|
+
end
|
32
|
+
|
33
|
+
assert_redirected_to product_url(Product.last)
|
34
|
+
end
|
35
|
+
|
36
|
+
test "should show product" do
|
37
|
+
get product_url(@product)
|
38
|
+
assert_response :success
|
39
|
+
end
|
40
|
+
|
41
|
+
test "should get edit" do
|
42
|
+
get edit_product_url(@product)
|
43
|
+
assert_response :success
|
44
|
+
end
|
45
|
+
|
46
|
+
test "should update product" do
|
47
|
+
params = {
|
48
|
+
product: {
|
49
|
+
description: @product.description,
|
50
|
+
name: @product.name,
|
51
|
+
price: @product.price,
|
52
|
+
},
|
53
|
+
}
|
54
|
+
|
55
|
+
patch product_url(@product), params: params
|
56
|
+
assert_redirected_to product_url(@product)
|
57
|
+
end
|
58
|
+
|
59
|
+
test "should destroy product" do
|
60
|
+
assert_difference('Product.count', -1) do
|
61
|
+
delete product_url(@product)
|
62
|
+
end
|
63
|
+
|
64
|
+
assert_redirected_to products_url
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class TestCasesControllerTest < ActionDispatch::IntegrationTest
|
6
|
+
include TaintedLoveHelpers
|
7
|
+
|
8
|
+
test "should get xss" do
|
9
|
+
assert_report do
|
10
|
+
get test_cases_xss_url(search: '<img src=x oenrror=alert(1)>')
|
11
|
+
end
|
12
|
+
|
13
|
+
assert_response :success
|
14
|
+
end
|
15
|
+
|
16
|
+
test "should get unsafe_render" do
|
17
|
+
assert_report do
|
18
|
+
get test_cases_unsafe_render_url(file: 'xss')
|
19
|
+
end
|
20
|
+
|
21
|
+
assert_response :success
|
22
|
+
end
|
23
|
+
|
24
|
+
test "should get render_inline" do
|
25
|
+
assert_report do
|
26
|
+
get test_cases_render_inline_url(template: '<%= `id` %>')
|
27
|
+
end
|
28
|
+
|
29
|
+
assert_response :success
|
30
|
+
end
|
31
|
+
|
32
|
+
test "should get unsafe_redirect" do
|
33
|
+
assert_report do
|
34
|
+
get test_cases_unsafe_redirect_url(to: 'http://evil.com')
|
35
|
+
end
|
36
|
+
|
37
|
+
assert_response :redirect
|
38
|
+
end
|
39
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ReplaceActiveRecordTest < ActiveSupport::TestCase
|
4
|
+
test "replaces where" do
|
5
|
+
assert_report do
|
6
|
+
Product.where("query".taint)
|
7
|
+
Product.where("query")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
test "replaces select" do
|
12
|
+
assert_report do
|
13
|
+
Product.select("query".taint)
|
14
|
+
Product.select("query")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
test "replaces find_by_sql" do
|
19
|
+
assert_report do
|
20
|
+
Product.find_by_sql("select * from products".taint)
|
21
|
+
Product.find_by_sql("select * from products")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
test "replaces count_by_sql" do
|
26
|
+
assert_report do
|
27
|
+
Product.count_by_sql("select * from products".taint)
|
28
|
+
Product.count_by_sql("select * from products")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
File without changes
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "application_system_test_case"
|
4
|
+
|
5
|
+
class ProductsTest < ApplicationSystemTestCase
|
6
|
+
setup do
|
7
|
+
@product = products(:one)
|
8
|
+
end
|
9
|
+
|
10
|
+
test "visiting the index" do
|
11
|
+
visit products_url
|
12
|
+
assert_selector "h1", text: "Products"
|
13
|
+
end
|
14
|
+
|
15
|
+
test "creating a Product" do
|
16
|
+
visit products_url
|
17
|
+
click_on "New Product"
|
18
|
+
|
19
|
+
fill_in "Description", with: @product.description
|
20
|
+
fill_in "Name", with: @product.name
|
21
|
+
fill_in "Price", with: @product.price
|
22
|
+
click_on "Create Product"
|
23
|
+
|
24
|
+
assert_text "Product was successfully created"
|
25
|
+
click_on "Back"
|
26
|
+
end
|
27
|
+
|
28
|
+
test "updating a Product" do
|
29
|
+
visit products_url
|
30
|
+
click_on "Edit", match: :first
|
31
|
+
|
32
|
+
fill_in "Description", with: @product.description
|
33
|
+
fill_in "Name", with: @product.name
|
34
|
+
fill_in "Price", with: @product.price
|
35
|
+
click_on "Update Product"
|
36
|
+
|
37
|
+
assert_text "Product was successfully updated"
|
38
|
+
click_on "Back"
|
39
|
+
end
|
40
|
+
|
41
|
+
test "destroying a Product" do
|
42
|
+
visit products_url
|
43
|
+
page.accept_confirm do
|
44
|
+
click_on "Destroy", match: :first
|
45
|
+
end
|
46
|
+
|
47
|
+
assert_text "Product was successfully destroyed"
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
ENV['RAILS_ENV'] ||= 'test'
|
4
|
+
require_relative '../config/environment'
|
5
|
+
require 'rails/test_help'
|
6
|
+
|
7
|
+
module TaintedLoveHelpers
|
8
|
+
def assert_report(n = 1, &block)
|
9
|
+
require 'minitest/mock'
|
10
|
+
mock = Minitest::Mock.new
|
11
|
+
|
12
|
+
n.times do
|
13
|
+
mock.expect(:call, nil, [Object, Object])
|
14
|
+
end
|
15
|
+
|
16
|
+
TaintedLove.stub(:report, mock, &block)
|
17
|
+
|
18
|
+
mock.verify
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module ActiveSupport
|
23
|
+
class TestCase
|
24
|
+
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
25
|
+
fixtures :all
|
26
|
+
|
27
|
+
# Add more helper methods to be used by all tests here...
|
28
|
+
include TaintedLoveHelpers
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
TaintedLove.enable! do |config|
|
33
|
+
config.reporter = Class.new {
|
34
|
+
def add_warning(warning)
|
35
|
+
end
|
36
|
+
}.new
|
37
|
+
end
|
data/example/tmp/.keep
ADDED
File without changes
|
File without changes
|