sanitize-rails 0.8.0 → 0.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0853ed8dac0969d869f6bc326b4c39c6a13f8ba
4
- data.tar.gz: 0987e863569b876662c020c747414f57544ac6ac
3
+ metadata.gz: fe1b33404aa8e997aba5fdf6101b25c3b5dde7a5
4
+ data.tar.gz: d74c48a669484082ed497713dc198e2ead6ab310
5
5
  SHA512:
6
- metadata.gz: c802cc9613d49098c9d870e7cc7f02bda1daa1ebb62a70392aba026090a8fd0783c0b2bf95787933434814f92329a9448e11fe8a5728bf0102b4b24c63f94fe6
7
- data.tar.gz: 4aad63b7ac6c064abae2beaf3302699acad762b2c35fb489ea249602313791c3598fb8fb43e212e9681a36189f80c735da116126f32d7acb7ca684b6a62d2aee
6
+ metadata.gz: 4a44d6ac9ae62f3c1aa68bf7569e289b9264afd2311d338c8a1bd8cd87bfa572b254727e0bdaf8b20ffe011120e687e3ef35e41fc9abb528243ffe79ca57ba23
7
+ data.tar.gz: 46ab3c9d6ac847044d1d8e5101890d717a1e981408b734a19b8c957aab348f95b3809dd62a61f231eb49658fef57ee6cd61838963f4bbcbec701ffb604d8612a
@@ -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:
@@ -1,5 +1,5 @@
1
1
  class Sanitize
2
2
  module Rails
3
- VERSION = '0.8.0'
3
+ VERSION = '0.8.1'
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ require 'sanitize'
5
5
  require 'sanitize/rails'
6
6
 
7
7
  # Test suite for Sanitize::Rails::Engine
8
- class SanitizeRailsEngineTest < MiniTest::Unit::TestCase
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 < MiniTest::Unit::TestCase
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
@@ -1,2 +1 @@
1
- require 'minitest/unit'
2
1
  require 'minitest/autorun'
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.0
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.0.3
83
+ rubygems_version: 2.2.2
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: A sanitizer bridge for Rails applications