mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
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:
@ -59,22 +59,38 @@ RSpec.describe Admin::EmojisController do
|
||||
it 'should allow an admin to add a custom emoji' do
|
||||
Emoji.expects(:clear_cache)
|
||||
|
||||
post "/admin/customize/emojis.json", params: {
|
||||
name: 'test',
|
||||
file: fixture_file_upload("#{Rails.root}/spec/fixtures/images/logo.png")
|
||||
}
|
||||
post "/admin/customize/emojis.json", params: {
|
||||
name: 'test',
|
||||
file: fixture_file_upload("#{Rails.root}/spec/fixtures/images/logo.png")
|
||||
}
|
||||
|
||||
custom_emoji = CustomEmoji.last
|
||||
upload = custom_emoji.upload
|
||||
custom_emoji = CustomEmoji.last
|
||||
upload = custom_emoji.upload
|
||||
|
||||
expect(upload.original_filename).to eq('logo.png')
|
||||
expect(upload.original_filename).to eq('logo.png')
|
||||
|
||||
data = JSON.parse(response.body)
|
||||
data = JSON.parse(response.body)
|
||||
expect(response.status).to eq(200)
|
||||
expect(data["errors"]).to eq(nil)
|
||||
expect(data["name"]).to eq(custom_emoji.name)
|
||||
expect(data["url"]).to eq(upload.url)
|
||||
expect(custom_emoji.group).to eq(nil)
|
||||
end
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(data["errors"]).to eq(nil)
|
||||
expect(data["name"]).to eq(custom_emoji.name)
|
||||
expect(data["url"]).to eq(upload.url)
|
||||
it 'should allow an admin to add a custom emoji with a custom group' do
|
||||
Emoji.expects(:clear_cache)
|
||||
|
||||
post "/admin/customize/emojis.json", params: {
|
||||
name: 'test',
|
||||
group: 'Foo',
|
||||
file: fixture_file_upload("#{Rails.root}/spec/fixtures/images/logo.png")
|
||||
}
|
||||
|
||||
custom_emoji = CustomEmoji.last
|
||||
|
||||
data = JSON.parse(response.body)
|
||||
expect(response.status).to eq(200)
|
||||
expect(custom_emoji.group).to eq("foo")
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user