Add Account.auditable
scope, fix N+1 in admin/action_logs#index (#28812)
This commit is contained in:
parent
5ae3bae586
commit
1480573c83
4 changed files with 22 additions and 2 deletions
|
@ -835,6 +835,25 @@ RSpec.describe Account do
|
|||
end
|
||||
|
||||
describe 'scopes' do
|
||||
describe 'auditable' do
|
||||
let!(:alice) { Fabricate :account }
|
||||
let!(:bob) { Fabricate :account }
|
||||
|
||||
before do
|
||||
2.times { Fabricate :action_log, account: alice }
|
||||
end
|
||||
|
||||
it 'returns distinct accounts with action log records' do
|
||||
results = described_class.auditable
|
||||
|
||||
expect(results.size)
|
||||
.to eq(1)
|
||||
expect(results)
|
||||
.to include(alice)
|
||||
.and not_include(bob)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'alphabetic' do
|
||||
it 'sorts by alphabetic order of domain and username' do
|
||||
matches = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue