From c54cbf7943693f2aa63cf9cb32941a674a7ba63b Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 16 Sep 2024 04:56:40 -0400 Subject: [PATCH] Remove `follow` creation from `ListAccount` fabricator (#31902) --- spec/fabricators/list_account_fabricator.rb | 6 ++++-- spec/models/list_account_spec.rb | 8 +++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/fabricators/list_account_fabricator.rb b/spec/fabricators/list_account_fabricator.rb index 00dde83cdf..fe5a471209 100644 --- a/spec/fabricators/list_account_fabricator.rb +++ b/spec/fabricators/list_account_fabricator.rb @@ -2,6 +2,8 @@ Fabricator(:list_account) do list - account - before_create { |list_account, _| list_account.list.account.follow!(account) } + + initialize_with do + resolved_class.new(list: list, account: list.account) + end end diff --git a/spec/models/list_account_spec.rb b/spec/models/list_account_spec.rb index e5aad2affa..b2ec17a563 100644 --- a/spec/models/list_account_spec.rb +++ b/spec/models/list_account_spec.rb @@ -9,7 +9,7 @@ RSpec.describe ListAccount do let(:list) { Fabricate :list, account: follow.account } it 'finds and sets the follow with the list account' do - list_account = described_class.create list: list, account: follow.target_account + list_account = Fabricate :list_account, list: list, account: follow.target_account expect(list_account) .to have_attributes( follow: eq(follow), @@ -23,7 +23,7 @@ RSpec.describe ListAccount do let(:list) { Fabricate :list, account: follow_request.account } it 'finds and sets the follow request with the list account' do - list_account = described_class.create list: list, account: follow_request.target_account + list_account = Fabricate :list_account, list: list, account: follow_request.target_account expect(list_account) .to have_attributes( follow: be_nil, @@ -33,10 +33,8 @@ RSpec.describe ListAccount do end context 'when list owner is the account' do - let(:list) { Fabricate :list } - it 'does not set follow or follow request' do - list_account = described_class.create list: list, account: list.account + list_account = Fabricate :list_account expect(list_account) .to have_attributes( follow: be_nil,