|
|
|
@ -130,10 +130,6 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
context 'when fetching' do |
|
|
|
context 'when fetching' do |
|
|
|
subject { described_class.new(json, sender) } |
|
|
|
subject { described_class.new(json, sender) } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
subject.perform |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context 'when object publication date is below ISO8601 range' do |
|
|
|
context 'when object publication date is below ISO8601 range' do |
|
|
|
let(:object_json) do |
|
|
|
let(:object_json) do |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -145,6 +141,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status with a valid creation date', :aggregate_failures do |
|
|
|
it 'creates status with a valid creation date', :aggregate_failures do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -165,6 +163,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status with a valid creation date', :aggregate_failures do |
|
|
|
it 'creates status with a valid creation date', :aggregate_failures do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -186,6 +186,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status with appropriate creation and edition dates', :aggregate_failures do |
|
|
|
it 'creates status with appropriate creation and edition dates', :aggregate_failures do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -209,17 +211,13 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status and does not mark it as edited' do |
|
|
|
status = sender.statuses.first |
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
|
|
|
|
expect(status.text).to eq 'Lorem ipsum' |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'does not mark status as edited' do |
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
|
|
|
|
expect(status.text).to eq 'Lorem ipsum' |
|
|
|
expect(status.edited?).to be false |
|
|
|
expect(status.edited?).to be false |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
@ -234,7 +232,7 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'does not create a status' do |
|
|
|
it 'does not create a status' do |
|
|
|
expect(sender.statuses.count).to be_zero |
|
|
|
expect { subject.perform }.to_not change(sender.statuses, :count) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@ -248,6 +246,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -255,6 +255,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'missing to/cc defaults to direct privacy' do |
|
|
|
it 'missing to/cc defaults to direct privacy' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -273,6 +275,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -291,6 +295,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -309,6 +315,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -327,6 +335,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -345,6 +355,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -363,6 +375,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -381,6 +395,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -403,6 +419,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -422,15 +440,13 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status with a silent mention' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status.visibility).to eq 'limited' |
|
|
|
expect(status.visibility).to eq 'limited' |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'creates silent mention' do |
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
expect(status.mentions.first).to be_silent |
|
|
|
expect(status.mentions.first).to be_silent |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
@ -452,6 +468,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -472,6 +490,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -500,6 +520,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -522,6 +544,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
end |
|
|
|
end |
|
|
|
@ -544,6 +568,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -569,6 +595,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -594,6 +622,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -619,6 +649,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -642,6 +674,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
end |
|
|
|
end |
|
|
|
@ -664,6 +698,42 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
|
|
|
|
expect(status.tags.map(&:name)).to include('test') |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context 'with featured hashtags' do |
|
|
|
|
|
|
|
let(:object_json) do |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, |
|
|
|
|
|
|
|
type: 'Note', |
|
|
|
|
|
|
|
content: 'Lorem ipsum', |
|
|
|
|
|
|
|
to: 'https://www.w3.org/ns/activitystreams#Public', |
|
|
|
|
|
|
|
tag: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
type: 'Hashtag', |
|
|
|
|
|
|
|
href: 'http://example.com/blah', |
|
|
|
|
|
|
|
name: '#test', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
sender.featured_tags.create!(name: 'test') |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'creates status and updates featured tag' do |
|
|
|
|
|
|
|
expect { subject.perform } |
|
|
|
|
|
|
|
.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
.and change { sender.featured_tags.first.reload.statuses_count }.by(1) |
|
|
|
|
|
|
|
.and change { sender.featured_tags.first.reload.last_status_at }.from(nil).to(be_within(0.1).of(Time.now.utc)) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -687,6 +757,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
end |
|
|
|
end |
|
|
|
@ -709,6 +781,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
end |
|
|
|
end |
|
|
|
@ -733,6 +807,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -759,6 +835,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
|
|
|
|
|
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
@ -784,6 +862,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
end |
|
|
|
end |
|
|
|
@ -805,6 +885,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
end |
|
|
|
end |
|
|
|
@ -835,13 +917,13 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'creates status' do |
|
|
|
it 'creates status with a poll' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(sender.statuses, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
status = sender.statuses.first |
|
|
|
status = sender.statuses.first |
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status).to_not be_nil |
|
|
|
expect(status.poll).to_not be_nil |
|
|
|
expect(status.poll).to_not be_nil |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'creates a poll' do |
|
|
|
|
|
|
|
poll = sender.polls.first |
|
|
|
poll = sender.polls.first |
|
|
|
expect(poll).to_not be_nil |
|
|
|
expect(poll).to_not be_nil |
|
|
|
expect(poll.status).to_not be_nil |
|
|
|
expect(poll.status).to_not be_nil |
|
|
|
@ -864,6 +946,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'adds a vote to the poll with correct uri' do |
|
|
|
it 'adds a vote to the poll with correct uri' do |
|
|
|
|
|
|
|
expect { subject.perform }.to change(poll.votes, :count).by(1) |
|
|
|
|
|
|
|
|
|
|
|
vote = poll.votes.first |
|
|
|
vote = poll.votes.first |
|
|
|
expect(vote).to_not be_nil |
|
|
|
expect(vote).to_not be_nil |
|
|
|
expect(vote.uri).to eq object_json[:id] |
|
|
|
expect(vote.uri).to eq object_json[:id] |
|
|
|
@ -889,6 +973,8 @@ RSpec.describe ActivityPub::Activity::Create do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'does not add a vote to the poll' do |
|
|
|
it 'does not add a vote to the poll' do |
|
|
|
|
|
|
|
expect { subject.perform }.to_not change(poll.votes, :count) |
|
|
|
|
|
|
|
|
|
|
|
expect(poll.votes.first).to be_nil |
|
|
|
expect(poll.votes.first).to be_nil |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|