Autofix Rubocop RSpec/LeadingSubject (#23670)
This commit is contained in:
parent
4ea1e0fceb
commit
4552685f6b
78 changed files with 256 additions and 338 deletions
|
@ -42,6 +42,8 @@ RSpec.describe ActivityPub::Activity::Accept do
|
|||
end
|
||||
|
||||
context 'given a relay' do
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
let!(:relay) { Fabricate(:relay, state: :pending, follow_activity_id: 'https://abc-123/456') }
|
||||
|
||||
let(:json) do
|
||||
|
@ -59,8 +61,6 @@ RSpec.describe ActivityPub::Activity::Accept do
|
|||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
it 'marks the relay as accepted' do
|
||||
subject.perform
|
||||
expect(relay.reload.accepted?).to be true
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::Activity::Announce do
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
let(:sender) { Fabricate(:account, followers_url: 'http://example.com/followers', uri: 'https://example.com/actor') }
|
||||
let(:recipient) { Fabricate(:account) }
|
||||
let(:status) { Fabricate(:status, account: recipient) }
|
||||
|
@ -27,8 +29,6 @@ RSpec.describe ActivityPub::Activity::Announce do
|
|||
}
|
||||
end
|
||||
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
describe '#perform' do
|
||||
context 'when sender is followed by a local account' do
|
||||
before do
|
||||
|
@ -110,13 +110,13 @@ RSpec.describe ActivityPub::Activity::Announce do
|
|||
end
|
||||
|
||||
context 'when the sender is relayed' do
|
||||
subject { described_class.new(json, sender, relayed_through_actor: relay_account) }
|
||||
|
||||
let!(:relay_account) { Fabricate(:account, inbox_url: 'https://relay.example.com/inbox') }
|
||||
let!(:relay) { Fabricate(:relay, inbox_url: 'https://relay.example.com/inbox') }
|
||||
|
||||
let(:object_json) { 'https://example.com/actor/hello-world' }
|
||||
|
||||
subject { described_class.new(json, sender, relayed_through_actor: relay_account) }
|
||||
|
||||
before do
|
||||
stub_request(:get, 'https://example.com/actor/hello-world').to_return(body: Oj.dump(unknown_object_json))
|
||||
end
|
||||
|
|
|
@ -752,6 +752,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
end
|
||||
|
||||
context 'with an encrypted message' do
|
||||
subject { described_class.new(json, sender, delivery: true, delivered_to_account_id: recipient.id) }
|
||||
|
||||
let(:recipient) { Fabricate(:account) }
|
||||
let(:object_json) do
|
||||
{
|
||||
|
@ -776,8 +778,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
end
|
||||
let(:target_device) { Fabricate(:device, account: recipient) }
|
||||
|
||||
subject { described_class.new(json, sender, delivery: true, delivered_to_account_id: recipient.id) }
|
||||
|
||||
before do
|
||||
subject.perform
|
||||
end
|
||||
|
@ -831,6 +831,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
end
|
||||
|
||||
context 'when sender replies to local status' do
|
||||
subject { described_class.new(json, sender, delivery: true) }
|
||||
|
||||
let!(:local_status) { Fabricate(:status) }
|
||||
let(:object_json) do
|
||||
{
|
||||
|
@ -841,8 +843,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
}
|
||||
end
|
||||
|
||||
subject { described_class.new(json, sender, delivery: true) }
|
||||
|
||||
before do
|
||||
subject.perform
|
||||
end
|
||||
|
@ -856,6 +856,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
end
|
||||
|
||||
context 'when sender targets a local user' do
|
||||
subject { described_class.new(json, sender, delivery: true) }
|
||||
|
||||
let!(:local_account) { Fabricate(:account) }
|
||||
let(:object_json) do
|
||||
{
|
||||
|
@ -866,8 +868,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
}
|
||||
end
|
||||
|
||||
subject { described_class.new(json, sender, delivery: true) }
|
||||
|
||||
before do
|
||||
subject.perform
|
||||
end
|
||||
|
@ -881,6 +881,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
end
|
||||
|
||||
context 'when sender cc\'s a local user' do
|
||||
subject { described_class.new(json, sender, delivery: true) }
|
||||
|
||||
let!(:local_account) { Fabricate(:account) }
|
||||
let(:object_json) do
|
||||
{
|
||||
|
@ -891,8 +893,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
}
|
||||
end
|
||||
|
||||
subject { described_class.new(json, sender, delivery: true) }
|
||||
|
||||
before do
|
||||
subject.perform
|
||||
end
|
||||
|
|
|
@ -121,6 +121,8 @@ RSpec.describe ActivityPub::Activity::Reject do
|
|||
end
|
||||
|
||||
context 'given a relay' do
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
let!(:relay) { Fabricate(:relay, state: :pending, follow_activity_id: 'https://abc-123/456') }
|
||||
|
||||
let(:json) do
|
||||
|
@ -138,8 +140,6 @@ RSpec.describe ActivityPub::Activity::Reject do
|
|||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
it 'marks the relay as rejected' do
|
||||
subject.perform
|
||||
expect(relay.reload.rejected?).to be true
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::Activity::Undo do
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
let(:sender) { Fabricate(:account, domain: 'example.com') }
|
||||
|
||||
let(:json) do
|
||||
|
@ -13,8 +15,6 @@ RSpec.describe ActivityPub::Activity::Undo do
|
|||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
describe '#perform' do
|
||||
context 'with Announce' do
|
||||
let(:status) { Fabricate(:status) }
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::Activity::Update do
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
let!(:sender) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
sender.update!(uri: ActivityPub::TagManager.instance.uri_for(sender))
|
||||
end
|
||||
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
describe '#perform' do
|
||||
context 'with an Actor object' do
|
||||
let(:modified_sender) do
|
||||
|
|
|
@ -41,10 +41,10 @@ RSpec.describe ActivityPub::Adapter do
|
|||
end
|
||||
|
||||
describe '#serializable_hash' do
|
||||
let(:serializer_class) {}
|
||||
|
||||
subject { ActiveModelSerializers::SerializableResource.new(TestObject.new(foo: 'bar'), serializer: serializer_class, adapter: described_class).as_json }
|
||||
|
||||
let(:serializer_class) {}
|
||||
|
||||
context 'when serializer defines no context' do
|
||||
let(:serializer_class) { TestWithBasicContextSerializer }
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe ActivityPub::Dereferencer do
|
||||
describe '#object' do
|
||||
subject { described_class.new(uri, permitted_origin: permitted_origin, signature_actor: signature_actor).object }
|
||||
|
||||
let(:object) { { '@context': 'https://www.w3.org/ns/activitystreams', id: 'https://example.com/foo', type: 'Note', content: 'Hoge' } }
|
||||
let(:permitted_origin) { 'https://example.com' }
|
||||
let(:signature_actor) { nil }
|
||||
let(:uri) { nil }
|
||||
|
||||
subject { described_class.new(uri, permitted_origin: permitted_origin, signature_actor: signature_actor).object }
|
||||
|
||||
before do
|
||||
stub_request(:get, 'https://example.com/foo').to_return(body: Oj.dump(object), headers: { 'Content-Type' => 'application/activity+json' })
|
||||
end
|
||||
|
|
|
@ -3,6 +3,8 @@ require 'rails_helper'
|
|||
RSpec.describe ActivityPub::LinkedDataSignature do
|
||||
include JsonLdHelper
|
||||
|
||||
subject { described_class.new(json) }
|
||||
|
||||
let!(:sender) { Fabricate(:account, uri: 'http://example.com/alice') }
|
||||
|
||||
let(:raw_json) do
|
||||
|
@ -14,8 +16,6 @@ RSpec.describe ActivityPub::LinkedDataSignature do
|
|||
|
||||
let(:json) { raw_json.merge('signature' => signature) }
|
||||
|
||||
subject { described_class.new(json) }
|
||||
|
||||
before do
|
||||
stub_jsonld_contexts!
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue