escape_utils 1.2.0 → 1.2.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
2
  SHA1:
3
- metadata.gz: d21e40641fb15698dc8d2bf394ae9ff766c99b65
4
- data.tar.gz: 2e72c13029f33a6cf11fd6980915552e62fa4d6b
3
+ metadata.gz: d7424e692690ecb13b6eb5ee969a532bd1fe505a
4
+ data.tar.gz: 5dcef4bb75091869f767949c6f3f93e97facfe03
5
5
  SHA512:
6
- metadata.gz: e095eec1d4b9580837a1d5af995f1c8a400c3dcca7ea1a8b3a4a3079809d4e72166b844b17791ab4c90c828be9d7b52331690f30ba88790f79ff18707ead49d6
7
- data.tar.gz: e89851568b2650c982297e6af0ae66d506c165be8ff5a3ea1f158f6665d1e15a567f5219741f5e4ab2a78ae5f503b093e171a600088c446dc487024224e9202f
6
+ metadata.gz: 64563f3e25b7525fac604004e6749ae05a96a156fa0dbac031b6b3dd6337833f9c4ede0a92c0d8952fa774dcfd94e87648b52b8b888a3c3730c9ecb64864922f
7
+ data.tar.gz: a96b091153d336cc744c445a6ff96d0ed99244e15f9628d44c492dcf393b39040404944bba55eda02badf2ab53c75b351212159c562d7ad99c08cd6652651613
@@ -118,6 +118,7 @@ static VALUE rb_eu_escape_html_as_html_safe(VALUE self, VALUE str)
118
118
  }
119
119
 
120
120
  rb_ivar_set(result, ID_at_html_safe, Qtrue);
121
+ rb_enc_associate(result, rb_enc_get(str));
121
122
 
122
123
  return result;
123
124
  }
@@ -1,3 +1,3 @@
1
1
  module EscapeUtils
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -4,6 +4,30 @@ class MyCustomHtmlSafeString < String
4
4
  end
5
5
 
6
6
  class HtmlEscapeTest < Minitest::Test
7
+ def test_escape_source_encoding_is_maintained
8
+ source = 'foobar'
9
+ str = EscapeUtils.escape_html_as_html_safe(source)
10
+ assert_equal source.encoding, str.encoding
11
+ end
12
+
13
+ def test_escape_binary_encoding_is_maintained
14
+ source = 'foobar'.b
15
+ str = EscapeUtils.escape_html_as_html_safe(source)
16
+ assert_equal source.encoding, str.encoding
17
+ end
18
+
19
+ def test_escape_uft8_encoding_is_maintained
20
+ source = 'foobar'.encode 'UTF-8'
21
+ str = EscapeUtils.escape_html_as_html_safe(source)
22
+ assert_equal source.encoding, str.encoding
23
+ end
24
+
25
+ def test_escape_us_ascii_encoding_is_maintained
26
+ source = 'foobar'.encode 'US-ASCII'
27
+ str = EscapeUtils.escape_html_as_html_safe(source)
28
+ assert_equal source.encoding, str.encoding
29
+ end
30
+
7
31
  def test_escape_basic_html_with_secure
8
32
  assert_equal "&lt;some_tag&#47;&gt;", EscapeUtils.escape_html("<some_tag/>")
9
33
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escape_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lopez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler