about summary refs log tree commit diff
path: root/spec/helpers/emoji_helper_spec.rb
blob: 6edf7672f7bd6d0b6fbde7b30088e60fc8f91a8d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'rails_helper'

RSpec.describe EmojiHelper, type: :helper do
  describe '#emojify' do
    it 'converts shortcodes to unicode' do
      text = ':book: Book'
      expect(emojify(text)).to eq '📖 Book'
    end

    it 'converts composite emoji shortcodes to unicode' do
      text = ':couple_ww:'
      expect(emojify(text)).to eq '👩❤👩'
    end

    it 'does not convert shortcodes that are part of a string into unicode' do
      text = ':see_no_evil::hear_no_evil::speak_no_evil:'
      expect(emojify(text)).to eq text
    end
  end
end