Reduce factory creation (12 -> 6) in UnfollowFollowWorker spec

This commit is contained in:
Matt Jankowski 2024-09-23 10:37:22 -04:00
parent 5dfdec6453
commit 57570c88c7

View File

@ -18,15 +18,13 @@ RSpec.describe UnfollowFollowWorker do
let(:show_reblogs) { true }
describe 'perform' do
it 'unfollows source account and follows target account' do
it 'unfollows source account and follows target account and preserves show_reblogs' do
subject.perform(local_follower.id, source_account.id, target_account.id)
expect(local_follower.following?(source_account)).to be false
expect(local_follower.following?(target_account)).to be true
end
it 'preserves show_reblogs' do
subject.perform(local_follower.id, source_account.id, target_account.id)
expect(Follow.find_by(account: local_follower, target_account: target_account).show_reblogs?).to be show_reblogs
expect(follow_record.show_reblogs?).to be show_reblogs
end
end
end
@ -35,16 +33,18 @@ RSpec.describe UnfollowFollowWorker do
let(:show_reblogs) { false }
describe 'perform' do
it 'unfollows source account and follows target account' do
it 'unfollows source account and follows target account and preserves show_reblogs' do
subject.perform(local_follower.id, source_account.id, target_account.id)
expect(local_follower.following?(source_account)).to be false
expect(local_follower.following?(target_account)).to be true
end
it 'preserves show_reblogs' do
subject.perform(local_follower.id, source_account.id, target_account.id)
expect(Follow.find_by(account: local_follower, target_account: target_account).show_reblogs?).to be show_reblogs
expect(follow_record.show_reblogs?).to be show_reblogs
end
end
end
def follow_record
Follow.find_by(account: local_follower, target_account: target_account)
end
end