sanitize-rails 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sanitize/rails.rb +2 -2
- data/lib/sanitize/rails/version.rb +1 -1
- data/test/sanitize_rails_engine_test.rb +9 -1
- data/test/sanitize_rails_string_extension_test.rb +1 -1
- data/test/test_helper.rb +0 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe1b33404aa8e997aba5fdf6101b25c3b5dde7a5
|
4
|
+
data.tar.gz: d74c48a669484082ed497713dc198e2ead6ab310
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a44d6ac9ae62f3c1aa68bf7569e289b9264afd2311d338c8a1bd8cd87bfa572b254727e0bdaf8b20ffe011120e687e3ef35e41fc9abb528243ffe79ca57ba23
|
7
|
+
data.tar.gz: 46ab3c9d6ac847044d1d8e5101890d717a1e981408b734a19b8c957aab348f95b3809dd62a61f231eb49658fef57ee6cd61838963f4bbcbec701ffb604d8612a
|
data/lib/sanitize/rails.rb
CHANGED
@@ -51,13 +51,13 @@ module Sanitize::Rails
|
|
51
51
|
# means that text passed through `Sanitize::Rails::Engine.clean`
|
52
52
|
# will not be escaped by ActionView's XSS filtering utilities.
|
53
53
|
def clean(string)
|
54
|
-
::ActiveSupport::SafeBuffer.new string.dup.tap { |s| clean!(s) }
|
54
|
+
::ActiveSupport::SafeBuffer.new string.to_s.dup.tap { |s| clean!(s) }
|
55
55
|
end
|
56
56
|
|
57
57
|
# Sanitizes the given `string` in place and does NOT mark it as `html_safe`
|
58
58
|
#
|
59
59
|
def clean!(string)
|
60
|
-
cleaner.clean!(string)
|
60
|
+
cleaner.clean!(string.to_s).to_s
|
61
61
|
end
|
62
62
|
|
63
63
|
def callback_for(options) #:nodoc:
|
@@ -5,7 +5,7 @@ require 'sanitize'
|
|
5
5
|
require 'sanitize/rails'
|
6
6
|
|
7
7
|
# Test suite for Sanitize::Rails::Engine
|
8
|
-
class SanitizeRailsEngineTest <
|
8
|
+
class SanitizeRailsEngineTest < Minitest::Test
|
9
9
|
def setup
|
10
10
|
@engine = Sanitize::Rails::Engine
|
11
11
|
end
|
@@ -50,4 +50,12 @@ class SanitizeRailsEngineTest < MiniTest::Unit::TestCase
|
|
50
50
|
new_string = @engine.clean string
|
51
51
|
assert_instance_of ::ActiveSupport::SafeBuffer, new_string
|
52
52
|
end
|
53
|
+
|
54
|
+
def test_clean_returns_blank_string_for_nil_input
|
55
|
+
assert_equal '', @engine.clean(nil)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_clean_bang_returns_blank_string_for_nil_input
|
59
|
+
assert_equal '', @engine.clean!(nil)
|
60
|
+
end
|
53
61
|
end
|
@@ -5,7 +5,7 @@ require 'sanitize'
|
|
5
5
|
require 'sanitize/rails'
|
6
6
|
|
7
7
|
# Test suite for Sanitize::Rails::Engine
|
8
|
-
class SanitizeRailsStringExtensionTest <
|
8
|
+
class SanitizeRailsStringExtensionTest < Minitest::Test
|
9
9
|
SanitizableString = Class.new(String) { include Sanitize::Rails::String }
|
10
10
|
|
11
11
|
def setup
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanitize-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcello Barnaba
|
@@ -15,28 +15,28 @@ dependencies:
|
|
15
15
|
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '3.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '3.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: sanitize
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '2.0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - ~>
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '2.0'
|
42
42
|
description:
|
@@ -47,8 +47,8 @@ executables: []
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
-
- .gitignore
|
51
|
-
- .travis.yml
|
50
|
+
- ".gitignore"
|
51
|
+
- ".travis.yml"
|
52
52
|
- Gemfile
|
53
53
|
- README.md
|
54
54
|
- Rakefile
|
@@ -70,17 +70,17 @@ require_paths:
|
|
70
70
|
- lib
|
71
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.2.2
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: A sanitizer bridge for Rails applications
|