# coding: utf-8
# frozen_string_literal: true
require 'rails_helper'
describe EmojiHelper do
before do
Plugin::CustomEmoji.clear_cache
end
after do
Plugin::CustomEmoji.clear_cache
end
describe "emoji_codes_to_img" do
it "replaces emoji codes by images" do
Plugin::CustomEmoji.register("xxxxxx", "/public/xxxxxx.png")
str = "This is a good day :xxxxxx: :woman: :man:t4:"
replaced_str = helper.emoji_codes_to_img(str)
expect(replaced_str).to eq("This is a good day ")
end
it "doesn't replace if code doesn't exist" do
str = "This is a good day :woman: :foo: :bar:t4: :man:t8:"
replaced_str = helper.emoji_codes_to_img(str)
expect(replaced_str).to eq("This is a good day :foo: :bar:t4: :man:t8:")
end
end
end