@ -18,6 +18,7 @@ RSpec.describe ActivityPub::Activity::Create do
stub_request ( :get , 'http://example.com/attachment.png' ) . to_return ( request_fixture ( 'avatar.txt' ) )
stub_request ( :get , 'http://example.com/attachment.png' ) . to_return ( request_fixture ( 'avatar.txt' ) )
stub_request ( :get , 'http://example.com/emoji.png' ) . to_return ( body : attachment_fixture ( 'emojo.png' ) )
stub_request ( :get , 'http://example.com/emoji.png' ) . to_return ( body : attachment_fixture ( 'emojo.png' ) )
stub_request ( :get , 'http://example.com/emojib.png' ) . to_return ( body : attachment_fixture ( 'emojo.png' ) , headers : { 'Content-Type' = > 'application/octet-stream' } )
end
end
describe '#perform' do
describe '#perform' do
@ -451,6 +452,32 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
end
end
context 'with emojis served with invalid content-type' do
let ( :object_json ) do
{
id : [ ActivityPub :: TagManager . instance . uri_for ( sender ) , '#bar' ] . join ,
type : 'Note' ,
content : 'Lorem ipsum :tinkong:' ,
tag : [
{
type : 'Emoji' ,
icon : {
url : 'http://example.com/emojib.png' ,
} ,
name : 'tinkong' ,
} ,
] ,
}
end
it 'creates status' do
status = sender . statuses . first
expect ( status ) . to_not be_nil
expect ( status . emojis . map ( & :shortcode ) ) . to include ( 'tinkong' )
end
end
context 'with emojis missing name' do
context 'with emojis missing name' do
let ( :object_json ) do
let ( :object_json ) do
{
{