gemojione-4.3.3/ 0000755 0000041 0000041 00000000000 13704150771 013532 5 ustar www-data www-data gemojione-4.3.3/.travis.yml 0000644 0000041 0000041 00000000563 13704150770 015646 0 ustar www-data www-data language: ruby
sudo: false
rvm:
- 2.0.0
- 2.1.0
- 2.2.5
- 2.3.1
- 2.4.0
- rbx-2
- ruby-head
- jruby-head
matrix:
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
- rvm: rbx-2
addons:
code_climate:
repo_token: 418bd243b301fd0d29e8762626cc63ee2b3d2c41124c2d880e0e00d59057f639
after_success:
- bundle exec codeclimate-test-reporter
gemojione-4.3.3/test/ 0000755 0000041 0000041 00000000000 13704150770 014510 5 ustar www-data www-data gemojione-4.3.3/test/gemojione_test.rb 0000644 0000041 0000041 00000030210 13704150770 020044 0 ustar www-data www-data # encoding: UTF-8
require File.absolute_path File.dirname(__FILE__) + '/test_helper'
describe Gemojione do
describe "image_url_for_name" do
it 'should generate url' do
assert_equal 'http://localhost:3000/1f300.png', Gemojione.image_url_for_name('cyclone')
end
it 'should generate url' do
assert_equal 'http://localhost:3000/1f44d.png', Gemojione.image_url_for_name('+1')
end
it 'should generate url' do
with_emoji_config(:use_svg, true) do
assert_equal 'http://localhost:3000/1F44D.svg', Gemojione.image_url_for_name('+1')
end
end
end
describe "image_url_for_unicode_moji" do
it 'should generate url' do
assert_equal 'http://localhost:3000/1f300.png', Gemojione.image_url_for_unicode_moji('π')
end
end
describe "asset_host" do
it 'should default to localhost' do
assert_equal 'http://localhost:3000', Gemojione.asset_host
end
it 'should be configurable' do
with_emoji_config(:asset_host, 'emoji') do
assert_equal 'emoji', Gemojione.asset_host
end
end
end
describe "asset_path" do
it 'should default to /' do
assert_equal '/', Gemojione.asset_path
end
it 'should be configurable' do
with_emoji_config(:asset_path, '/emoji') do
assert_equal '/emoji', Gemojione.asset_path
end
end
end
describe 'default size' do
it 'should default to nil' do
assert_equal nil, Gemojione.default_size
end
it 'should be configurable' do
with_emoji_config(:default_size, '32px') do
assert_equal '32px', Gemojione.default_size
end
end
end
describe 'image_tag_for_moji' do
it 'should generate a clean img tag if default_size undefined' do
assert_equal '
', Gemojione.image_tag_for_moji('π')
end
it 'should generate a img tag with style tag if default_size is defined' do
Gemojione.default_size='42px'
assert_equal '
', Gemojione.image_tag_for_moji('π')
Gemojione.default_size=nil
end
it 'should generate spritesheet tag' do
with_emoji_config(:use_sprite, true) do
assert_equal "π", Gemojione.image_tag_for_moji('π')
end
end
end
describe "replace_unicode_moji_with_images" do
it 'should return original string without emoji' do
assert_equal "foo", Gemojione.replace_unicode_moji_with_images('foo')
end
it 'should escape html in non html_safe aware strings' do
replaced_string = Gemojione.replace_unicode_moji_with_images('β€