Autofix Rubocop RSpec/LeadingSubject (#23670)
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/account', featured_collection_url: 'https://example.com/account/pinned') }
|
||||
|
||||
let!(:known_status) { Fabricate(:status, account: actor, uri: 'https://example.com/account/pinned/1') }
|
||||
@ -56,8 +58,6 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
shared_examples 'sets pinned posts' do
|
||||
before do
|
||||
stub_request(:get, 'https://example.com/account/pinned/1').to_return(status: 200, body: Oj.dump(status_json_1))
|
||||
|
@ -1,6 +1,8 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchFeaturedTagsCollectionService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:collection_url) { 'https://example.com/account/tags' }
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/account') }
|
||||
|
||||
@ -21,8 +23,6 @@ RSpec.describe ActivityPub::FetchFeaturedTagsCollectionService, type: :service d
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
shared_examples 'sets featured tags' do
|
||||
before do
|
||||
subject.call(actor, collection_url)
|
||||
|
@ -3,6 +3,8 @@ require 'rails_helper'
|
||||
RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
let!(:sender) { Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar') }
|
||||
let!(:recipient) { Fabricate(:account) }
|
||||
|
||||
@ -18,8 +20,6 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
||||
}
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
before do
|
||||
stub_request(:get, 'https://foo.bar/watch?v=12345').to_return(status: 404, body: '')
|
||||
stub_request(:get, object[:id]).to_return(body: Oj.dump(object))
|
||||
|
@ -1,6 +1,8 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchRepliesService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
|
||||
let(:status) { Fabricate(:status, account: actor) }
|
||||
let(:collection_uri) { 'http://example.com/replies/1' }
|
||||
@ -28,8 +30,6 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
describe '#call' do
|
||||
context 'when the payload is a Collection with inlined replies' do
|
||||
context 'when passing the collection itself' do
|
||||
|
@ -31,6 +31,8 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
end
|
||||
|
||||
context 'when account is not suspended' do
|
||||
subject { described_class.new.call('alice', 'example.com', payload) }
|
||||
|
||||
let!(:account) { Fabricate(:account, username: 'alice', domain: 'example.com') }
|
||||
|
||||
let(:payload) do
|
||||
@ -46,8 +48,6 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
allow(Admin::SuspensionWorker).to receive(:perform_async)
|
||||
end
|
||||
|
||||
subject { described_class.new.call('alice', 'example.com', payload) }
|
||||
|
||||
it 'suspends account remotely' do
|
||||
expect(subject.suspended?).to be true
|
||||
expect(subject.suspension_origin_remote?).to be true
|
||||
@ -60,6 +60,8 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
end
|
||||
|
||||
context 'when account is suspended' do
|
||||
subject { described_class.new.call('alice', 'example.com', payload) }
|
||||
|
||||
let!(:account) { Fabricate(:account, username: 'alice', domain: 'example.com', display_name: '') }
|
||||
|
||||
let(:payload) do
|
||||
@ -78,8 +80,6 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
account.suspend!(origin: suspension_origin)
|
||||
end
|
||||
|
||||
subject { described_class.new.call('alice', 'example.com', payload) }
|
||||
|
||||
context 'locally' do
|
||||
let(:suspension_origin) { :local }
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
|
||||
|
||||
let(:payload) do
|
||||
@ -19,8 +21,6 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||
|
||||
let(:json) { Oj.dump(payload) }
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
describe '#call' do
|
||||
context 'when actor is suspended' do
|
||||
before do
|
||||
|
@ -5,6 +5,8 @@ def poll_option_json(name, votes)
|
||||
end
|
||||
|
||||
RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let!(:status) { Fabricate(:status, text: 'Hello world', account: Fabricate(:account, domain: 'example.com')) }
|
||||
let(:payload) do
|
||||
{
|
||||
@ -35,8 +37,6 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
||||
media_attachments.each { |m| status.media_attachments << m }
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
describe '#call' do
|
||||
it 'updates text' do
|
||||
subject.call(status, json)
|
||||
|
@ -1,6 +1,8 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::SynchronizeFollowersService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account', inbox_url: 'http://example.com/inbox') }
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
@ -25,8 +27,6 @@ RSpec.describe ActivityPub::SynchronizeFollowersService, type: :service do
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
shared_examples 'synchronizes followers' do
|
||||
before do
|
||||
alice.follow!(actor)
|
||||
|
Reference in New Issue
Block a user