Sha256: 7c1e15252b1b9b4443d8f26e1c550735c6f8889b1fd1b24d1fa6ec7ec5040edd

Contents?: true

Size: 867 Bytes

Versions: 6

Compression:

Stored size: 867 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 alt=\"❤\" 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

6 entries across 6 versions & 1 rubygems

Version Path
emoji-1.0.7 test/string_ext_test.rb
emoji-1.0.6 test/string_ext_test.rb
emoji-1.0.5 test/string_ext_test.rb
emoji-1.0.4 test/string_ext_test.rb
emoji-1.0.2 test/string_ext_test.rb
emoji-1.0.1 test/string_ext_test.rb