Sha256: f53eaec45f78d8487a69b202f07f9140768afe5cf4a086dfd2a2477aaaa0a9af

Contents?: true

Size: 855 Bytes

Versions: 2

Compression:

Stored size: 855 Bytes

Contents

# encoding: UTF-8

require 'emoji/string_ext'

describe String, 'with Emoji extensions' do
  describe '#with_emoji_images' do
    it 'should replace unicode moji with an img tag' do
      base_string = "I ❤ Emoji"
      replaced_string = base_string.with_emoji_images
      assert_equal "I <img class=\"emoji\" src=\"http://localhost:3000/heart.png\"> Emoji", replaced_string
    end
  end

  describe '#image_url' do
    it 'should generate image_url' do
      assert_equal 'http://localhost:3000/cyclone.png', '🌀'.image_url
      assert_equal 'http://localhost:3000/cyclone.png', 'cyclone'.image_url
    end
  end

  describe '#emoji_data' do
    it 'should find data for a name or a moji' do
      data_from_moji = '❤'.emoji_data
      data_from_string = 'heart'.emoji_data

      assert_equal data_from_moji, data_from_string
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
emoji-1.0.0 test/string_ext_test.rb
emoji-1.0.0.pre test/string_ext_test.rb