0
0
Fork 0

Reduce factory usage across spec/services area (#32098)

This commit is contained in:
Matt Jankowski 2024-10-04 10:11:15 -04:00 committed by GitHub
parent 4fe7f213a6
commit e4e07b1c34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 567 additions and 641 deletions

View file

@ -10,17 +10,15 @@ RSpec.describe RejectFollowService do
describe 'local' do
let(:bob) { Fabricate(:account) }
before do
FollowRequest.create(account: bob, target_account: sender)
before { FollowRequest.create(account: bob, target_account: sender) }
it 'removes follow request and does not create relation' do
subject.call(bob, sender)
end
it 'removes follow request' do
expect(bob.requested?(sender)).to be false
end
it 'does not create follow relation' do
expect(bob.following?(sender)).to be false
expect(bob)
.to_not be_requested(sender)
expect(bob)
.to_not be_following(sender)
end
end
@ -30,19 +28,17 @@ RSpec.describe RejectFollowService do
before do
FollowRequest.create(account: bob, target_account: sender)
stub_request(:post, bob.inbox_url).to_return(status: 200)
end
it 'removes follow request, does not create relation, sends reject activity', :inline_jobs do
subject.call(bob, sender)
end
it 'removes follow request' do
expect(bob.requested?(sender)).to be false
end
it 'does not create follow relation' do
expect(bob.following?(sender)).to be false
end
it 'sends a reject activity', :inline_jobs do
expect(a_request(:post, bob.inbox_url)).to have_been_made.once
expect(bob)
.to_not be_requested(sender)
expect(bob)
.to_not be_following(sender)
expect(a_request(:post, bob.inbox_url))
.to have_been_made.once
end
end
end