twemoji 2.0.1 → 2.1.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.
@@ -1,3 +1,3 @@
1
1
  module Twemoji
2
- VERSION = "2.0.1"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -1,3 +1,15 @@
1
1
  require "bundler/setup"
2
2
  require "twemoji"
3
3
  require "minitest/autorun"
4
+
5
+ module Twemoji
6
+ module TestExtensions
7
+ def assert_nothing_raised
8
+ yield if block_given?
9
+ end
10
+ end
11
+ end
12
+
13
+ class Minitest::Test
14
+ include Twemoji::TestExtensions
15
+ end
@@ -115,4 +115,56 @@ class TwemojiTest < Minitest::Test
115
115
  def test_emoji_pattern
116
116
  assert_kind_of Regexp, Twemoji.emoji_pattern
117
117
  end
118
+
119
+ def test_to_json_unsupported_file_ext
120
+ assert_raises RuntimeError do
121
+ Twemoji.to_json(file_ext: "bmp")
122
+ end
123
+ end
124
+
125
+ def test_to_json_unsupported_png_size
126
+ assert_raises RuntimeError do
127
+ Twemoji.to_json(file_ext: "png", image_size: "24x24")
128
+ end
129
+ end
130
+
131
+ def test_to_json_svg_format
132
+ json = assert_nothing_raised do
133
+ Twemoji.to_json(file_ext: "svg")
134
+ end
135
+
136
+ refute_includes json, "png"
137
+ end
138
+
139
+ def test_to_json_svg_format_ignore_image_size
140
+ json = assert_nothing_raised do
141
+ Twemoji.to_json(file_ext: "svg", image_size: "16x16")
142
+ end
143
+
144
+ refute_includes json, "png"
145
+ end
146
+
147
+ def test_to_json_png_format_size_16x16
148
+ json = assert_nothing_raised do
149
+ Twemoji.to_json(file_ext: "png", image_size: "16x16")
150
+ end
151
+
152
+ refute_includes json, "svg"
153
+ end
154
+
155
+ def test_to_json_png_format_size_36x36
156
+ json = assert_nothing_raised do
157
+ Twemoji.to_json(file_ext: "png", image_size: "36x36")
158
+ end
159
+
160
+ refute_includes json, "svg"
161
+ end
162
+
163
+ def test_to_json_png_format_size_72x72
164
+ json = assert_nothing_raised do
165
+ Twemoji.to_json(file_ext: "png", image_size: "72x72")
166
+ end
167
+
168
+ refute_includes json, "svg"
169
+ end
118
170
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twemoji
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juanito
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-19 00:00:00.000000000 Z
12
+ date: 2015-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -35,12 +35,14 @@ files:
35
35
  - ".gitignore"
36
36
  - ".travis.yml"
37
37
  - CHANGELOG.md
38
+ - CONTRIBUTING.md
38
39
  - Gemfile
39
- - LICENSE
40
+ - LICENSE.md
40
41
  - README.md
41
42
  - Rakefile
42
43
  - lib/twemoji.rb
43
44
  - lib/twemoji/configuration.rb
45
+ - lib/twemoji/json.rb
44
46
  - lib/twemoji/map.rb
45
47
  - lib/twemoji/version.rb
46
48
  - test/configuration_test.rb