Extract counters from accounts table to account_stats table (#9295)
This commit is contained in:
parent
4fdefffb99
commit
d6b9a62e0a
25 changed files with 203 additions and 68 deletions
|
@ -754,24 +754,6 @@ RSpec.describe Account, type: :model do
|
|||
expect(Account.suspended).to match_array([account_1])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'without_followers' do
|
||||
it 'returns a relation of accounts without followers' do
|
||||
account_1 = Fabricate(:account)
|
||||
account_2 = Fabricate(:account)
|
||||
Fabricate(:follow, account: account_1, target_account: account_2)
|
||||
expect(Account.without_followers).to match_array([account_1])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with_followers' do
|
||||
it 'returns a relation of accounts with followers' do
|
||||
account_1 = Fabricate(:account)
|
||||
account_2 = Fabricate(:account)
|
||||
Fabricate(:follow, account: account_1, target_account: account_2)
|
||||
expect(Account.with_followers).to match_array([account_2])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when is local' do
|
||||
|
|
4
spec/models/account_stat_spec.rb
Normal file
4
spec/models/account_stat_spec.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AccountStat, type: :model do
|
||||
end
|
|
@ -101,7 +101,7 @@ RSpec.describe Notification, type: :model do
|
|||
before do
|
||||
allow(accounts_with_ids).to receive(:[]).with(stale_account1.id).and_return(account1)
|
||||
allow(accounts_with_ids).to receive(:[]).with(stale_account2.id).and_return(account2)
|
||||
allow(Account).to receive_message_chain(:where, :each_with_object).and_return(accounts_with_ids)
|
||||
allow(Account).to receive_message_chain(:where, :includes, :each_with_object).and_return(accounts_with_ids)
|
||||
end
|
||||
|
||||
let(:cached_items) do
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe StatusStat, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue