1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Fix failing specs

This commit is contained in:
Adam Niedzielski 2024-07-29 14:54:41 +02:00
parent bab725fc31
commit 7ac3053673
No known key found for this signature in database
GPG key ID: D97FC2C798BAC058
2 changed files with 15 additions and 17 deletions

View file

@ -46,16 +46,14 @@ describe Account::Counters do
end
it 'preserves last_status_at when decrementing statuses_count' do
account_stat = Fabricate(
:account_stat,
account: account,
last_status_at: 3.days.ago,
statuses_count: 10
)
account.statuses_count = 10
account.save!
account.account_stat.last_status_at = 3.days.ago
account.account_stat.save!
expect { account.decrement_count!(:statuses_count) }
.to change(account_stat.reload, :statuses_count).by(-1)
.and not_change(account_stat.reload, :last_status_at)
.to change(account.account_stat.reload, :statuses_count).by(-1)
.and not_change(account.account_stat.reload, :last_status_at)
end
end
end

View file

@ -17,7 +17,7 @@ describe 'Directories API' do
user: Fabricate(:user, confirmed_at: nil, approved: true),
username: 'local_unconfirmed'
)
local_unconfirmed_account.create_account_stat!
local_unconfirmed_account.account_stat.save!
local_unapproved_account = Fabricate(
:account,
@ -25,7 +25,7 @@ describe 'Directories API' do
user: Fabricate(:user, confirmed_at: 10.days.ago),
username: 'local_unapproved'
)
local_unapproved_account.create_account_stat!
local_unapproved_account.account_stat.save!
local_unapproved_account.user.update(approved: false)
local_undiscoverable_account = Fabricate(
@ -35,7 +35,7 @@ describe 'Directories API' do
discoverable: false,
username: 'local_undiscoverable'
)
local_undiscoverable_account.create_account_stat!
local_undiscoverable_account.account_stat.save!
excluded_from_timeline_account = Fabricate(
:account,
@ -43,7 +43,7 @@ describe 'Directories API' do
discoverable: true,
username: 'remote_excluded_from_timeline'
)
excluded_from_timeline_account.create_account_stat!
excluded_from_timeline_account.account_stat.save!
Fabricate(:block, account: user.account, target_account: excluded_from_timeline_account)
domain_blocked_account = Fabricate(
@ -52,11 +52,11 @@ describe 'Directories API' do
discoverable: true,
username: 'remote_domain_blocked'
)
domain_blocked_account.create_account_stat!
domain_blocked_account.account_stat.save!
Fabricate(:account_domain_block, account: user.account, domain: 'test.example')
local_discoverable_account.create_account_stat!
eligible_remote_account.create_account_stat!
local_discoverable_account.account_stat.save!
eligible_remote_account.account_stat.save!
end
let(:local_discoverable_account) do
@ -93,8 +93,8 @@ describe 'Directories API' do
let(:remote_account) { Fabricate(:account, domain: 'host.example') }
before do
local_account.create_account_stat!
remote_account.create_account_stat!
local_account.account_stat.save!
remote_account.account_stat.save!
end
it 'returns only the local accounts' do