html_terminator 3.0.0 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0bb5210795341af31d333be566cb6ff673a4dce3
4
- data.tar.gz: 00589ce6418e7af7f0ef38670eaf3fce10abfbd2
2
+ SHA256:
3
+ metadata.gz: 9a7a8946175692f847d9c8b647ff9eb519813406b5a5994a00c979404e20c777
4
+ data.tar.gz: ca19d579c5f12681c65d07663a538016651c4927b70365c29fabd0a05a13e7ed
5
5
  SHA512:
6
- metadata.gz: 9426fa5939c9b35d2bdc8b5c2944b02554fd005179db9b24c4312640aa6e8aa4cadd6c929a6a46eb813a514afae51074c3e58c2090020b79fc55710b75ac9d92
7
- data.tar.gz: dd1f6ad48c8326aee8c3b22e5c2709ebba530e64e55200673ffecbd2212358e374f569eecffe49d8e6f2e4c47a0a932a13d2c09d53d795810c2f01a4d8d9fcfd
6
+ metadata.gz: acc02f9bc1eb2811f1247f85b2c01b89f56374dd5fa8bcb7db22c10cdc2261a75d90c747c8c04db71ba535997b3b0dce5ddb8388baf136cc14f8c38fb6930b1a
7
+ data.tar.gz: d7c4a6e1e5ccce26db2b603325290ab324133896a9ca6d0566d8ed8ea42f72b55fab34d2d0c8a8eaf5ded653a1163e08b70b87f13aae39849d6378c35ec4ef19
@@ -0,0 +1,22 @@
1
+ name: CI
2
+ on: [push]
3
+ jobs:
4
+ lint-test:
5
+ name: Test
6
+ runs-on: ubuntu-latest
7
+ timeout-minutes: 10
8
+ strategy:
9
+ matrix:
10
+ ruby:
11
+ - 2.5
12
+ - 2.6
13
+ - 2.7
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+
20
+
21
+ - run: bundle install
22
+ - run: bundle exec rspec
data/Gemfile CHANGED
@@ -4,8 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :test do
7
- gem "activerecord", "~> 4.2"
8
- gem 'sqlite3'
9
- gem 'guard-rspec'
10
- gem 'rb-fsevent'
7
+ gem "activerecord", "~> 6.0"
8
+ gem 'sqlite3', "~> 1.4.2" # tied to activerecord
9
+ gem 'rspec'
11
10
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["steel@polleverywhere.com", "matt@polleverywhere.com"]
11
11
  spec.description = %q{Terminate Active Records fields of html}
12
12
  spec.summary = %q{Terminate Active Records fields of html}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/polleverywhere/html_terminator/"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "bundler", "~> 2.2.0"
22
22
  spec.add_development_dependency "rake"
23
23
 
24
- spec.add_runtime_dependency "sanitize", "~> 4.0"
24
+ spec.add_runtime_dependency "sanitize", "~> 6.0.0"
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module HtmlTerminator
2
- VERSION = "3.0.0"
3
- end
2
+ VERSION = '6.0.1'
3
+ end
@@ -11,7 +11,7 @@ module HtmlTerminator
11
11
  if val.is_a?(String)
12
12
  # Sanitize produces escaped content.
13
13
  # Unescape it to get the raw html
14
- CGI.unescapeHTML(Sanitize.fragment(val, config).strip).html_safe
14
+ CGI.unescapeHTML(Sanitize.fragment(val, config).strip)
15
15
  else
16
16
  val
17
17
  end
@@ -58,6 +58,8 @@ module HtmlTerminator
58
58
  end
59
59
  end
60
60
  end
61
+ rescue ActiveRecord::ConnectionNotEstablished
62
+ # Treat as if the table doesn't exist
61
63
  end
62
64
  end
63
65
 
@@ -5,60 +5,65 @@ describe HtmlTerminator do
5
5
  user = OnlyFirstName.new
6
6
 
7
7
  user.first_name = "Hello <img>"
8
- user.first_name.should == "Hello"
8
+ expect(user.first_name).to eql("Hello")
9
9
 
10
10
  user.last_name = "Hello <img>"
11
- user.last_name.should == "Hello <img>"
11
+ expect(user.last_name).to eql("Hello <img>")
12
12
 
13
13
  user.age = 3
14
- user.age.should == 3
14
+ expect(user.age).to eql(3)
15
15
  end
16
16
 
17
17
  it "doesn't escape ampersands" do
18
18
  user = OnlyFirstName.new
19
19
 
20
20
  user.first_name = "A & B & C"
21
- user.first_name.should == "A & B & C"
21
+ expect(user.first_name).to eql("A & B & C")
22
22
  end
23
23
 
24
24
  it "skips sanitize when only one bracket" do
25
25
  user = OnlyFirstName.new
26
26
 
27
27
  user.first_name = "1 < 2"
28
- user.first_name.should == "1 < 2"
28
+ expect(user.first_name).to eql("1 < 2")
29
29
 
30
30
  user.first_name = "2 > 1"
31
- user.first_name.should == "2 > 1"
31
+ expect(user.first_name).to eql("2 > 1")
32
32
  end
33
33
 
34
34
  it "handles ampersands" do
35
35
  user = OnlyFirstName.new
36
36
 
37
37
  user.first_name = "Mr. & Mrs. Smith"
38
- user.first_name.should == "Mr. & Mrs. Smith"
38
+ expect(user.first_name).to eql("Mr. & Mrs. Smith")
39
39
  end
40
40
 
41
41
  it "doesn't blow up if value is not a string" do
42
42
  user = OnlyFirstName.new
43
43
  user.first_name = 1
44
- user.first_name.should == "1"
44
+ expect(user.first_name).to eql("1")
45
45
  end
46
46
 
47
47
  it "honors options that are passed in" do
48
48
  user = FirstNameWithOptions.new
49
49
  user.first_name = "Hello <flexbox></flexbox><hr><br><img>"
50
- user.first_name.should == "Hello <flexbox></flexbox>"
50
+ expect(user.first_name).to eql("Hello <flexbox></flexbox>")
51
51
  end
52
52
 
53
53
  describe "#sanitize" do
54
54
  it "strips out all html by default" do
55
55
  val = HtmlTerminator.sanitize "<flexbox></flexbox><hr><br><img>"
56
- val.should == ""
56
+ expect(val).to eql("")
57
57
  end
58
58
 
59
- it "marks the output as html_safe" do
59
+ it "does not mark the output as html_safe" do
60
60
  val = HtmlTerminator.sanitize "<flexbox></flexbox><hr><br><img>"
61
- val.html_safe?.should == true
61
+ expect(val.html_safe?).to eql(false)
62
+ end
63
+
64
+ it "does not escape output that isn't stripped" do
65
+ val = HtmlTerminator.sanitize "<div>I said, \"Hello, John O'hare.\"</div>"
66
+ expect(val).to eql("I said, \"Hello, John O'hare.\"")
62
67
  end
63
68
  end
64
69
 
@@ -67,8 +72,8 @@ describe HtmlTerminator do
67
72
  user.first_name = "Hello <br><strong>strong</strong><em>em</em>"
68
73
  user.last_name = "Hello <br><strong>strong</strong><em>em</em>"
69
74
 
70
- user.first_name.should == "Hello <strong>strong</strong>em"
71
- user.last_name.should == "Hello strong<em>em</em>"
75
+ expect(user.first_name).to eql("Hello <strong>strong</strong>em")
76
+ expect(user.last_name).to eql("Hello strong<em>em</em>")
72
77
  end
73
78
 
74
79
  it "sanitizes on validation" do
@@ -77,7 +82,7 @@ describe HtmlTerminator do
77
82
  user.last_name = "Hello <br><strong>strong</strong><em>em</em>"
78
83
  user.valid?
79
84
 
80
- user.read_attribute(:first_name).should == "Hello <strong>strong</strong>em"
81
- user.read_attribute(:last_name).should == "Hello strong<em>em</em>"
85
+ expect(user.read_attribute(:first_name)).to eql("Hello <strong>strong</strong>em")
86
+ expect(user.read_attribute(:last_name)).to eql("Hello strong<em>em</em>")
82
87
  end
83
88
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_terminator
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steel Fu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-04 00:00:00.000000000 Z
12
+ date: 2021-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.3'
20
+ version: 2.2.0
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.3'
27
+ version: 2.2.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '4.0'
48
+ version: 6.0.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '4.0'
55
+ version: 6.0.0
56
56
  description: Terminate Active Records fields of html
57
57
  email:
58
58
  - steel@polleverywhere.com
@@ -61,10 +61,9 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
+ - ".github/workflows/ci.yml"
64
65
  - ".gitignore"
65
- - ".travis.yml"
66
66
  - Gemfile
67
- - Guardfile
68
67
  - LICENSE.txt
69
68
  - README.md
70
69
  - Rakefile
@@ -75,7 +74,7 @@ files:
75
74
  - spec/html_terminator_spec.rb
76
75
  - spec/spec_helper.rb
77
76
  - spec/support/active_record.rb
78
- homepage: ''
77
+ homepage: https://github.com/polleverywhere/html_terminator/
79
78
  licenses:
80
79
  - MIT
81
80
  metadata: {}
@@ -94,8 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
93
  - !ruby/object:Gem::Version
95
94
  version: '0'
96
95
  requirements: []
97
- rubyforge_project:
98
- rubygems_version: 2.2.3
96
+ rubygems_version: 3.0.3.1
99
97
  signing_key:
100
98
  specification_version: 4
101
99
  summary: Terminate Active Records fields of html
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- script: bundle exec rspec
2
- language: ruby
3
- rvm:
4
- - 2.0.0
data/Guardfile DELETED
@@ -1,5 +0,0 @@
1
- guard 'rspec', :version => 2, :cli => '--colour --format nested' do
2
- watch(%r{^spec/.+_spec\.rb$})
3
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
- watch('spec/spec_helper.rb') { "spec" }
5
- end