html_terminator 3.0.0 → 4.0.0

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
2
  SHA1:
3
- metadata.gz: 0bb5210795341af31d333be566cb6ff673a4dce3
4
- data.tar.gz: 00589ce6418e7af7f0ef38670eaf3fce10abfbd2
3
+ metadata.gz: 7290d4a6c7f8e108d9df4b7e77e75b6069bc74f2
4
+ data.tar.gz: 4f0facdb558e55c8ff3edb0344b3758b62bcb38a
5
5
  SHA512:
6
- metadata.gz: 9426fa5939c9b35d2bdc8b5c2944b02554fd005179db9b24c4312640aa6e8aa4cadd6c929a6a46eb813a514afae51074c3e58c2090020b79fc55710b75ac9d92
7
- data.tar.gz: dd1f6ad48c8326aee8c3b22e5c2709ebba530e64e55200673ffecbd2212358e374f569eecffe49d8e6f2e4c47a0a932a13d2c09d53d795810c2f01a4d8d9fcfd
6
+ metadata.gz: 5688b605b7dfbf502da3393b394b7924ecb053458fc469cec30dfcfddac971271fe2e04a73a6fdb9199122caa3850b0e110dddb528f68f2e2d78e80449b6944f
7
+ data.tar.gz: d30608cee5cb486746e7428ce5a0801a5710bebe0601338b0049bfa69c110cdcd24b99af96ab0755ea4c3c17b31e6c30f157945f49d3ea2279523bbfc6ccf742
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
1
  script: bundle exec rspec
2
2
  language: ruby
3
3
  rvm:
4
- - 2.0.0
4
+ - 2.1.10
5
+ - 2.2.5
6
+ - 2.3.1
7
+ gemfile: Gemfile.ci
data/Gemfile.ci ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in html_terminator.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem "activerecord", "~> 4.2"
8
+ gem "sqlite3"
9
+ gem "rspec"
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($/)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module HtmlTerminator
2
- VERSION = "3.0.0"
3
- end
2
+ VERSION = "4.0.0"
3
+ end
@@ -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: 4.0.0
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: 2016-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -64,6 +64,7 @@ files:
64
64
  - ".gitignore"
65
65
  - ".travis.yml"
66
66
  - Gemfile
67
+ - Gemfile.ci
67
68
  - Guardfile
68
69
  - LICENSE.txt
69
70
  - README.md
@@ -75,7 +76,7 @@ files:
75
76
  - spec/html_terminator_spec.rb
76
77
  - spec/spec_helper.rb
77
78
  - spec/support/active_record.rb
78
- homepage: ''
79
+ homepage: https://github.com/polleverywhere/html_terminator/
79
80
  licenses:
80
81
  - MIT
81
82
  metadata: {}
@@ -95,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
96
  version: '0'
96
97
  requirements: []
97
98
  rubyforge_project:
98
- rubygems_version: 2.2.3
99
+ rubygems_version: 2.5.1
99
100
  signing_key:
100
101
  specification_version: 4
101
102
  summary: Terminate Active Records fields of html