mirror of
https://github.com/mastodon/mastodon.git
synced 2024-10-02 21:01:06 +02:00
Reduce factory creation (12 -> 6) in UnfollowFollowWorker
spec
This commit is contained in:
parent
5dfdec6453
commit
57570c88c7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user