FEATURE: allows multiple custom emoji groups (#9308)

Note: DBHelper would fail with a sql syntax error on columns like "group".

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
Joffrey JAFFEUX
2020-03-30 20:16:10 +02:00
committed by GitHub
parent fa5ba6beb8
commit 0996c3b7b3
24 changed files with 428 additions and 138 deletions

View File

@ -538,4 +538,30 @@ describe Plugin::Instance do
expect(Reviewable.types).to match_array(current_list << new_element)
end
end
describe '#register_emoji' do
before do
Plugin::CustomEmoji.clear_cache
end
it 'allows to register an emoji' do
Plugin::Instance.new.register_emoji("foo", "/foo/bar.png")
custom_emoji = Emoji.custom.first
expect(custom_emoji.name).to eq("foo")
expect(custom_emoji.url).to eq("/foo/bar.png")
expect(custom_emoji.group).to eq(Emoji::DEFAULT_GROUP)
end
it 'allows to register an emoji with a group' do
Plugin::Instance.new.register_emoji("bar", "/baz/bar.png", "baz")
custom_emoji = Emoji.custom.first
expect(custom_emoji.name).to eq("bar")
expect(custom_emoji.url).to eq("/baz/bar.png")
expect(custom_emoji.group).to eq("baz")
end
end
end