|
|
@ -6,7 +6,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
let(:json) do
|
|
|
|
let(:json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
|
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
|
|
id: 'foo',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#foo'].join,
|
|
|
|
type: 'Create',
|
|
|
|
type: 'Create',
|
|
|
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
|
|
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
|
|
|
object: object_json,
|
|
|
|
object: object_json,
|
|
|
@ -16,6 +16,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
subject { described_class.new(json, sender) }
|
|
|
|
subject { described_class.new(json, sender) }
|
|
|
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
before do
|
|
|
|
|
|
|
|
sender.update(uri: ActivityPub::TagManager.instance.uri_for(sender))
|
|
|
|
|
|
|
|
|
|
|
|
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'))
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -28,7 +30,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'standalone' do
|
|
|
|
context 'standalone' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -52,7 +54,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'public' do
|
|
|
|
context 'public' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
to: 'https://www.w3.org/ns/activitystreams#Public',
|
|
|
|
to: 'https://www.w3.org/ns/activitystreams#Public',
|
|
|
@ -70,7 +72,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'unlisted' do
|
|
|
|
context 'unlisted' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
cc: 'https://www.w3.org/ns/activitystreams#Public',
|
|
|
|
cc: 'https://www.w3.org/ns/activitystreams#Public',
|
|
|
@ -88,7 +90,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'private' do
|
|
|
|
context 'private' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
to: 'http://example.com/followers',
|
|
|
|
to: 'http://example.com/followers',
|
|
|
@ -108,7 +110,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
|
|
|
|
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
to: ActivityPub::TagManager.instance.uri_for(recipient),
|
|
|
|
to: ActivityPub::TagManager.instance.uri_for(recipient),
|
|
|
@ -128,7 +130,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
|
|
|
|
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
inReplyTo: ActivityPub::TagManager.instance.uri_for(original_status),
|
|
|
|
inReplyTo: ActivityPub::TagManager.instance.uri_for(original_status),
|
|
|
@ -151,7 +153,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
|
|
|
|
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
tag: [
|
|
|
|
tag: [
|
|
|
@ -174,7 +176,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'with mentions missing href' do
|
|
|
|
context 'with mentions missing href' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
tag: [
|
|
|
|
tag: [
|
|
|
@ -194,7 +196,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'with media attachments' do
|
|
|
|
context 'with media attachments' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
attachment: [
|
|
|
|
attachment: [
|
|
|
@ -218,7 +220,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'with media attachments missing url' do
|
|
|
|
context 'with media attachments missing url' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
attachment: [
|
|
|
|
attachment: [
|
|
|
@ -239,7 +241,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'with hashtags' do
|
|
|
|
context 'with hashtags' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
tag: [
|
|
|
|
tag: [
|
|
|
@ -263,7 +265,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'with hashtags missing name' do
|
|
|
|
context 'with hashtags missing name' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
tag: [
|
|
|
|
tag: [
|
|
|
@ -284,7 +286,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'with emojis' do
|
|
|
|
context 'with emojis' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum :tinking:',
|
|
|
|
content: 'Lorem ipsum :tinking:',
|
|
|
|
tag: [
|
|
|
|
tag: [
|
|
|
@ -310,7 +312,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'with emojis missing name' do
|
|
|
|
context 'with emojis missing name' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum :tinking:',
|
|
|
|
content: 'Lorem ipsum :tinking:',
|
|
|
|
tag: [
|
|
|
|
tag: [
|
|
|
@ -333,7 +335,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|
|
|
context 'with emojis missing icon' do
|
|
|
|
context 'with emojis missing icon' do
|
|
|
|
let(:object_json) do
|
|
|
|
let(:object_json) do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: 'bar',
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
|
|
type: 'Note',
|
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum :tinking:',
|
|
|
|
content: 'Lorem ipsum :tinking:',
|
|
|
|
tag: [
|
|
|
|
tag: [
|
|
|
|