# encoding: UTF-8 require File.absolute_path File.dirname(__FILE__) + '/test_helper' describe Emoji do describe "image_url_for_name" do it 'should generate url' do assert_equal 'http://localhost:3000/cyclone.png', Emoji.image_url_for_name('cyclone') end end describe "image_url_for_unicode_moji" do it 'should generate url' do assert_equal 'http://localhost:3000/cyclone.png', Emoji.image_url_for_unicode_moji('🌀') end end describe "asset_host" do it 'should default to localhost' do assert_equal 'http://localhost:3000', Emoji.asset_host end it 'should be configurable' do with_emoji_config(:asset_host, 'emoji') do assert_equal 'emoji', Emoji.asset_host end end end describe "asset_path" do it 'should default to /' do assert_equal '/', Emoji.asset_path end it 'should be configurable' do with_emoji_config(:asset_path, '/emoji') do assert_equal '/emoji', Emoji.asset_path end end end describe "replace_unicode_moji_with_images" do it 'should return original string without emoji' do assert_equal "foo", Emoji.replace_unicode_moji_with_images('foo') end it 'should escape html in non html_safe aware strings' do replaced_string = Emoji.replace_unicode_moji_with_images('❤