0
0
Fork 0

Fix RSpec/ContextWording cop (#24739)

This commit is contained in:
Matt Jankowski 2023-05-03 23:49:08 -04:00 committed by GitHub
parent cf18cc2891
commit 710745e16b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 559 additions and 668 deletions

View file

@ -43,7 +43,7 @@ RSpec.describe ActivityPub::Activity::Accept do
end
end
context 'given a relay' do
context 'when given a relay' do
subject { described_class.new(json, sender) }
let!(:relay) { Fabricate(:relay, state: :pending, follow_activity_id: 'https://abc-123/456') }

View file

@ -39,7 +39,7 @@ RSpec.describe ActivityPub::Activity::Announce do
subject.perform
end
context 'a known status' do
context 'with known status' do
let(:object_json) do
ActivityPub::TagManager.instance.uri_for(status)
end
@ -49,7 +49,7 @@ RSpec.describe ActivityPub::Activity::Announce do
end
end
context 'an unknown status' do
context 'with unknown status' do
let(:object_json) { 'https://example.com/actor/hello-world' }
it 'creates a reblog by sender of status' do
@ -60,7 +60,7 @@ RSpec.describe ActivityPub::Activity::Announce do
end
end
context 'self-boost of a previously unknown status with correct attributedTo' do
context 'when self-boost of a previously unknown status with correct attributedTo' do
let(:object_json) do
{
id: 'https://example.com/actor#bar',
@ -76,7 +76,7 @@ RSpec.describe ActivityPub::Activity::Announce do
end
end
context 'self-boost of a previously unknown status with correct attributedTo, inlined Collection in audience' do
context 'when self-boost of a previously unknown status with correct attributedTo, inlined Collection in audience' do
let(:object_json) do
{
id: 'https://example.com/actor#bar',
@ -123,7 +123,7 @@ RSpec.describe ActivityPub::Activity::Announce do
stub_request(:get, 'https://example.com/actor/hello-world').to_return(body: Oj.dump(unknown_object_json))
end
context 'and the relay is enabled' do
context 'when the relay is enabled' do
before do
relay.update(state: :accepted)
subject.perform
@ -135,7 +135,7 @@ RSpec.describe ActivityPub::Activity::Announce do
end
end
context 'and the relay is disabled' do
context 'when the relay is disabled' do
before do
subject.perform
end

View file

@ -31,7 +31,7 @@ RSpec.describe ActivityPub::Activity::Create do
subject.perform
end
context 'object has been edited' do
context 'when object has been edited' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -57,7 +57,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'object has update date equal to creation date' do
context 'when object has update date equal to creation date' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -83,7 +83,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'unknown object type' do
context 'with an unknown object type' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -97,7 +97,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'standalone' do
context 'with a standalone' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -121,7 +121,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'public with explicit public address' do
context 'when public with explicit public address' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -139,7 +139,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'public with as:Public' do
context 'when public with as:Public' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -157,7 +157,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'public with Public' do
context 'when public with Public' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -175,7 +175,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'unlisted with explicit public address' do
context 'when unlisted with explicit public address' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -193,7 +193,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'unlisted with as:Public' do
context 'when unlisted with as:Public' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -211,7 +211,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'unlisted with Public' do
context 'when unlisted with Public' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -229,7 +229,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'private' do
context 'when private' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -247,7 +247,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'private with inlined Collection in audience' do
context 'when private with inlined Collection in audience' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -269,7 +269,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'limited' do
context 'when limited' do
let(:recipient) { Fabricate(:account) }
let(:object_json) do
@ -294,7 +294,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'direct' do
context 'when direct' do
let(:recipient) { Fabricate(:account) }
let(:object_json) do
@ -318,7 +318,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'as a reply' do
context 'with a reply' do
let(:original_status) { Fabricate(:status) }
let(:object_json) do

View file

@ -20,7 +20,7 @@ RSpec.describe ActivityPub::Activity::Follow do
subject { described_class.new(json, sender) }
context 'with no prior follow' do
context 'unlocked account' do
context 'with an unlocked account' do
before do
subject.perform
end
@ -35,7 +35,7 @@ RSpec.describe ActivityPub::Activity::Follow do
end
end
context 'silenced account following an unlocked account' do
context 'when silenced account following an unlocked account' do
before do
sender.touch(:silenced_at)
subject.perform
@ -51,7 +51,7 @@ RSpec.describe ActivityPub::Activity::Follow do
end
end
context 'unlocked account muting the sender' do
context 'with an unlocked account muting the sender' do
before do
recipient.mute!(sender)
subject.perform
@ -67,7 +67,7 @@ RSpec.describe ActivityPub::Activity::Follow do
end
end
context 'locked account' do
context 'when locked account' do
before do
recipient.update(locked: true)
subject.perform
@ -89,7 +89,7 @@ RSpec.describe ActivityPub::Activity::Follow do
sender.active_relationships.create!(target_account: recipient, uri: 'bar')
end
context 'unlocked account' do
context 'with an unlocked account' do
before do
subject.perform
end
@ -103,7 +103,7 @@ RSpec.describe ActivityPub::Activity::Follow do
end
end
context 'silenced account following an unlocked account' do
context 'when silenced account following an unlocked account' do
before do
sender.touch(:silenced_at)
subject.perform
@ -118,7 +118,7 @@ RSpec.describe ActivityPub::Activity::Follow do
end
end
context 'unlocked account muting the sender' do
context 'with an unlocked account muting the sender' do
before do
recipient.mute!(sender)
subject.perform
@ -133,7 +133,7 @@ RSpec.describe ActivityPub::Activity::Follow do
end
end
context 'locked account' do
context 'when locked account' do
before do
recipient.update(locked: true)
subject.perform
@ -154,7 +154,7 @@ RSpec.describe ActivityPub::Activity::Follow do
sender.follow_requests.create!(target_account: recipient, uri: 'bar')
end
context 'silenced account following an unlocked account' do
context 'when silenced account following an unlocked account' do
before do
sender.touch(:silenced_at)
subject.perform
@ -170,7 +170,7 @@ RSpec.describe ActivityPub::Activity::Follow do
end
end
context 'locked account' do
context 'when locked account' do
before do
recipient.update(locked: true)
subject.perform

View file

@ -27,7 +27,7 @@ RSpec.describe ActivityPub::Activity::Reject do
describe '#perform' do
subject { described_class.new(json, sender) }
context 'rejecting a pending follow request by target' do
context 'when rejecting a pending follow request by target' do
before do
Fabricate(:follow_request, account: recipient, target_account: sender)
subject.perform
@ -42,7 +42,7 @@ RSpec.describe ActivityPub::Activity::Reject do
end
end
context 'rejecting a pending follow request by uri' do
context 'when rejecting a pending follow request by uri' do
before do
Fabricate(:follow_request, account: recipient, target_account: sender, uri: 'bar')
subject.perform
@ -57,7 +57,7 @@ RSpec.describe ActivityPub::Activity::Reject do
end
end
context 'rejecting a pending follow request by uri only' do
context 'when rejecting a pending follow request by uri only' do
let(:object_json) { 'bar' }
before do
@ -74,7 +74,7 @@ RSpec.describe ActivityPub::Activity::Reject do
end
end
context 'rejecting an existing follow relationship by target' do
context 'when rejecting an existing follow relationship by target' do
before do
Fabricate(:follow, account: recipient, target_account: sender)
subject.perform
@ -89,7 +89,7 @@ RSpec.describe ActivityPub::Activity::Reject do
end
end
context 'rejecting an existing follow relationship by uri' do
context 'when rejecting an existing follow relationship by uri' do
before do
Fabricate(:follow, account: recipient, target_account: sender, uri: 'bar')
subject.perform
@ -104,7 +104,7 @@ RSpec.describe ActivityPub::Activity::Reject do
end
end
context 'rejecting an existing follow relationship by uri only' do
context 'when rejecting an existing follow relationship by uri only' do
let(:object_json) { 'bar' }
before do
@ -122,7 +122,7 @@ RSpec.describe ActivityPub::Activity::Reject do
end
end
context 'given a relay' do
context 'when given a relay' do
subject { described_class.new(json, sender) }
let!(:relay) { Fabricate(:relay, state: :pending, follow_activity_id: 'https://abc-123/456') }